sql: rows in one table but not in another
This comes up a lot in database programming. How do you write a SQL query that selects rows that are in one table but not in another table? Here's the answer:
select a.field0
from table0 a
where not exists
(select b.field0
from table1 b
where b.field0 = a.field0)
2 Comments:
Thanks, randomly got this in a google search and it helped us with some voter info in Florida.
Thanks also, just found this via google and it fixed my conundrum.
Greetings from Nottingham, UK, by the way :)
Post a Comment
<< Home