|
Posted by Tony on 07/08/05 21:58
Jim F wrote:
> Hi,
>
> I have two tables (A and B) with id fields in them, I would like a
> list of ids that are in A but not in B.
>
> How would I do this in SQL?
Let's see - to show ID's that matched:
SELECT tableA.id, tableB.id FROM tableA, tableB WHERE tableA.id=tableB.id
I think it would be simplest to just invert this. Maybe this?
SELECT tableA.id, tableB.id FROM tableA, tableB WHERE NOT
tableA.id=tableB.id
Or perhaps
SELECT tableA.id, tableB.id FROM tableA, tableB WHERE tableA.id != tableB.id
I think the first is more likely to give what you want. Mind you, this is
untested...
--
Tony Garcia
Web Right! Development
Riverside, CA
www.WebRightDevelopment.com
Navigation:
[Reply to this message]
|