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:
7mida | bo9al
3disa | 7mida
7mida | bo9al
3disa | 7mida
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
Chico
Chico2y ago
Looks like your sql is malformed select from where and not select where from Edit that select part doesn’t look right
venego
venegoOP2y ago
Does it matter though? Just focus on the point please, even col != '*' is not correct syntax. But that doesn't matter in this context.
Want results from more Discord servers?
Add your server