> select distinct PersonID
> from PersonProject
> where ProjectID != '2';
> 
> Is this what you are looking for?


No, what I'm looking for is...
SELECT PersonID 
FROM PersonProject 
AND PersonID NOT IN     (SELECT PersonID 
                                FROM PersonProjectID
                                WHERE ProjectID='2')

But this can't be done in MySQL, so does anybody know a work-around?



Original question follows...
> How can I get a list of all PersonID's who are not in 
> ProjectID 2 (i.e.
> PersonID 3 and 4)?
> 
> Table: PersonProject
> 
> PersonID      | ProjectID
> -------------------
> 1             | 1
> 2             | 1
> 3             | 1
> 1             | 2
> 2             | 2
> 1             | 3
> 2             | 3
> 3             | 3
> 4             | 3
> 
> 
> BTW "SELECT PersonID from PersonProject where ProjectID != 
> '2'" doesn't work
> 
> 
> ---------------------------------------------------------------------
> 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
> 

---------------------------------------------------------------------
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