* Michael Ayres
> +---+---+
> | a | b |
> +---+---+
> | 1 | 1 |
> | 1 | 2 |
> | 2 | 2 |
> | 3 | 1 |
> +---+---+
> 
> I would like to retrieve the set of all a where b !=2
> so in the above example, only 3 would be returned...

Use a LEFT JOIN:

SELECT t1.* 
  FROM t1 
  LEFT JOIN t1 AS t2 ON 
    t2.a=t1.a AND 
    t2.b=2 
  WHERE ISNULL(t2.a);

-- 
Roger
database, table

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