Yes.  Use an exclusive outer join (my term, not official.)

SELECT username from tableA left join tableB on tableA.id = tableB.id
WHERE tableB.id IS NULL;

This will first form an outer join, building a set of rows from tableA,
regardless of having a matching record in tableB.  Then the WHERE clause
narrows this set down, eliminating any result row with info in the
column tableB.id, which in my example, and in your data, should never be
null unless the row is absent.

Of course, id is my own column, because you didn't tell us how to join
between tableA and tableB.

> -----Original Message-----
> From: Doug Wolfgram [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, July 10, 2003 1:08 PM
> To: [EMAIL PROTECTED]
> Subject: AND NOT
> 
> 
> Is there any easy way to create this type of QUERY?
> 
> I am trying to get a list of usernames from table A who do NOT have a 
> linked record in Table B.
> 
> D
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/mysql?> [EMAIL PROTECTED]
> 
> 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

  • AND NOT Doug Wolfgram
    • Kevin Fries

Reply via email to