April 16, 2007 at 3:08 am
create TABLE xyz
(
id_xyz int
)
DROP TABLE pqr
CREATE TABLE pqr
(
id_pqr int
)
INSERT INTO xyz VALUES (101)
INSERT INTO pqr VALUES (101)
INSERT INTO xyz VALUES (102)
INSERT INTO pqr VALUES (102)
INSERT INTO xyz VALUES (103)
INSERT INTO pqr VALUES (103)
INSERT INTO xyz VALUES (104)
INSERT INTO pqr VALUES (105)
-- Ur answer !!
SELECT id_xyz
FROM xyz
where id_xyz not in (select Id_pqr from pqr)
union all
SELECT id_pqr
FROM pqr
where id_pqr not in (select id_xyz from xyz)
enjoy!
April 16, 2007 at 4:54 pm
Perhaps it's the difference in language and culture, Sandeep. You post didn't sound right at all. There is a way to ask for help especially on these types of forums... your post seemed like so many others where the requester thought it would inspire others to do their homework by issuing a "challenge". That and the fact that you requested to compare two employee tables (should never happen in a real data base) make us all think that this is homework.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 16, 2007 at 8:45 pm
I thought the puzzle was BS also and I still do. Hence, my NZDF answer.
April 17, 2007 at 8:02 am
select ID from Emp1 where ID not in (select ID from Emp2) UNION select ID from Emp2 where ID not in (select ID from Emp1)
April 23, 2007 at 4:17 pm
All of the banter here has shown the multiple methods of solving a SQL problem. I for one have learned no matter what the initial impetus of the post.
RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."
Viewing 5 posts - 16 through 19 (of 19 total)
You must be logged in to reply to this topic. Login to reply