I am developing a web application in java. There I use several MySQL tables.
One of them marks 'relationships' between two objects. So i created a table:
id username relation timestamp
1 user1 user2 2014-11-18 12:20:03
2 user2 user1 2014-11-18 12:20:03
a user is related to another when this user marked the other user as 'related' AND the second user marked the first as well.
in case of
id username relation timestamp
3 user1 user3 2014-11-18 12:20:03
there is no relationship.
I can count the amount of one-sided relationships of a user. But now I need to count the amount of real (two-sided) relationships of one user. Can I use the COUNT command?