I need help with an sql query and have no idea how to do it. I can descibe my table layout and explain what I wait to do.
Theres two tables. matchs and users. Each user must fight the other user and it gets put into the match table.
users
id|name
1|Pests
2|Joe
3|Bob
4|Mike
matchs:
id|user1|user2
1|1|2
2|1|3
3|2|3
What I want to do is select all the users someone has not fought yet. Obvisly, you cant fight yourself so user1 and user2 will never be the same value. With the example above, If I wanted to find out which fights Pests has to do then it would return Mike, since his id is the only one missing out of the matchs table. For Joe it would return Pests, Bob, Mike.
Can anyone help with this? It needs to be one sql query.