March 31, 2009 at 4:13 am
Hi gurus,
I have 2 tables.
table A (id -1,2,3,4,5) [id is int]
and table B(id - 1,2,3) [id is int]
I need a SQL join statement which will give me the 4 nad 5 id from table A (i.e. the non matching results). Outer join is not working because, there is no matching id between the table for 4 and 5.
Thanks in advance.
March 31, 2009 at 4:23 am
SELECT A.Id
FROM TableA A
WHERE NOT EXISTS
(
SELECT *
FROM TableB B
WHERE B.Id = A.Id
)
or
SELECT A.Id
FROM TableA A
LEFT JOIN TableB B
ON A.Id = B.Id
WHERE B.Id IS NULL
March 31, 2009 at 5:26 am
Hi Ken,
Both queries are working fine.
Actually I have tried with left outer join also, but not used the null.
Many thanks for ur help.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply