On Monday 13 May 2002 17:49, John Doe wrote:
> Simle query request: I want to display the ID for everyone in a table who
> is NOT in a second table.
>
> so this is what I have come up with
>
> SELECT student.SID, student.firstName
> FROM student
> WHERE student.SID NOT IN
>      (SELECT msoccerroster.SID
>       FROM msoccerroster)
>


Well, MySQL does not support sub-selects, but you can left join the tables:

SELECT student.SID, student.firstName
FROM student
LEFT JOIN msoccerroster
ON msoccerroster.SID = student.SID
WHERE msoccerroster.SID IS NULL

that should work fine.



>
> It comes up with an error 1064: SQL syntax near '(SELECT msoccerroster.SID
> FROM msoccerroster)'
>
> please help
> J
>
>


-- 
Joćo Paulo Vasconcellos
Gerente de Tecnologia - NetCard
Tel. 21 3852-9008 Ramal 31
[EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to