pjohns
29th October 2002, 11:46
Hi,

Can somebody help me with a query which I'm having difficulty in getting to run.

I have three tables, A, B and C, which all have a column called ITEM_ID.

I want to find out what Items exist in tables A and B but not in C.

I've tried the following but it seems to get lost in the Ether.....
select item_id
from table A
where item_id NOT IN (select item_id from table C);
Thanks

PJ

James
29th October 2002, 12:32
Hi pjohns,

My SQL is also poor :) My guess is something like this:

select a.item_id, b.item_id
from tableA a, tableB b
where a.item_id=b.item_id
and
a.item_id NOT IN (select item_id from tableC);

Have fun.