Dan Greene wrote:

select unique t1.*
from table1 as t1
left outer join table2 as t2 on t2.name = t1.name
where t2.name is null

That'll get the t1s not in t2, but not the other way around.  Consider:
SELECT t1.name, t2.name
 FROM table1 t1 LEFT JOIN table2 t2 ON t1.name = t2.name
 WHERE t2.name IS NULL
UNION
SELECT t1.name, t2.name
 FROM table2 t2 LEFT JOIN table1 t1 ON t2.name = t1.name
 WHERE t1.name IS NULL

Bruce Feist

-----Original Message-----
From: xander xxx [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 11, 2003 2:56 AM


Yes, that�s exactly what i get, but that�s not what i want. I wanna get all nanes in table1 that don�t appear in table2, and all names in table2 that don�t appear in table1. That�s why i use "<>" in the query. If i use "=" instead of "<>" i get all names in table1 that appear in table2, then, How can i get the oposite?






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



Reply via email to