0
Hello, I’m making a facebook clone database. I have two tables, one of users and another friendship. The friendships table is a self relationship of users as shown in the image.
This table of friendships contains each user’s Ids and I need to select common friendships between two selected users. For example:
| idUsuario1 | idUsuario2 |
| ------------- | ------------- |
| 1. | 2. |
| 2. | 3. |
| 2. | 4. |
| 1. | 3. |
I need to search in this table the common friends of user1 and user2. That is, the return will be 3.4. But I can’t properly filter the output.