Can someone please give me a push into the right direction to find the query I need for MySQL?
I've ben strugling with it all night with no success..
I have two tables:
Table P (Persons)
NR NAME
1 Bill
2 Eva
3 John
4 Ben
5 Susan
Table M (Meetings)
HOSTNR GUESTNR
5 1
3 1
3 5
5 3
(hostnr and guestnr are the numbers corresponding with NR in the table P)
Now I need a list of all Persons NAME that aren't guests of 3.
In this example they are 2 and 4 (since 3 cannot be it's own guest as well).
It should be something like:
SELECT P.NAME FROM P WHERE (P.NR NOT IN (SELECT M.GUESTNR FROM M WHERE M.HOSTNR=3)) AND P.NR <> 3
But I found out that MySQL doesn't cope with subqueries.
Is there a solution with some kind of JOIN construction?
TIA/Jan
Comment