Sorry for my English. I have two tables: users and friends. I can not use amounted join query to retrieve data about users. The first request - show users if they are at each other's friends list.
id|id_friend
1|2
2|1
3|1
1|3
1|6
7|1
If I have id = 1, then get friend with id = 2 and 3.
The second request - to show people who have sent a request, but did not receive a response. If I have id = 1, then get only friend with id = 6.
The third request - show people who do not approve the request. If I have id = 1, then get only friend with id = 7.
If I use this query, you get 2, 3, 6:
SELECT * FROM users INNER JOIN friends ON friends.id = 1 AND users.id = friends.id_friend
Aucun commentaire:
Enregistrer un commentaire