Ok, this is a little tricky to explain but can be very easy to implement.
I have a table with the following structure:
`match_id` int(69) NOT NULL auto_increment,
`event_id` int(6) NOT NULL,
`users_id` int(6) NOT NULL,
`matches` int(6) default NULL
so here is a sample of the data
33 11 54 1221
32 11 54 21
31 11 21 54
30 11 43 54
So, in English, this is what needs to happen:
It is a personal selection chart where user1 selects user2 and vice-versa. I only need the USERS_ID where they are mutually selected.
If I am looking for matches = 54, I would need to get users_id =21. Because 54 matched 21 and 21 matched 54.
Any ideas on how to write the SQL statement for this?
Thanks a lot.
Bruno.
Try this: