Click to See Complete Forum and Search --> : Compare Two Tables


r4gn0
10-11-2006, 03:56 PM
im trying to compare two tables and show info that isnt in one of them:

Id Name
01 Me
02 You
03 They


Proyect Id In Date Out Date
p001 02 10-06-06 10-09-06
p002 01 10-06-06 10-10-06

i need a query to show that "they" isnt workin on a proyect

i tried with many querys but it didnt work...can someone help me?

chazzy
10-11-2006, 04:48 PM
select * from table1 where table1.id not in (select Id from table2)

russell
10-12-2006, 11:00 PM
this will show all names not assigned to a proyect

SELECT name
FROM people a
LEFT JOIN
proyects b
On a.id = b.id
WHERE b.id is NULL
of course you'll need to put in the real table names. i called 'em people and proyects