How do I represent relationships in a sql database?
I don't want to duplicate the connection twice, so I though there would be a way to do this in sql.
I'm not good at sql, but I would assume that the logic of the query would be something like:
select col!='7mida' where userA='7mida' or userB='7mida' from connections;
Where "7mida" is the guy I'm trying to list his friends. So the table needs to be filtered twice in one query.
It's possible that I only filter once, using sql, and get something like so:
Then, using programming, I can let list only the ones that do not match the target's name. But I though first to check if something similar to the first option exists.
Please help!2 Replies