July 24, 2008 at 4:46 am
Hi there,
Could you plese help me in the following case..
Am trying to extract the recods from a table who have the particular data only.
e,g
empid code
1 s1
1 s2
1 s3
2 s1
2 s2
3 s1
here we go
I need to get the out of emp who have the code only s1 or s2 or both .
so the out put must be empid 2,3
hope I try my level best to explain what am looking for...
thanks for helping me out.
many thanks
July 24, 2008 at 5:15 am
hi,
CREATE TABLE TEST(empid int, empcode varchar(5))
INSERT INTO TEST values (1,'s1')
INSERT INTO TEST values (1,'s2')
INSERT INTO TEST values (1,'s3')
INSERT INTO TEST values (2,'s1')
INSERT INTO TEST values (2,'s2')
INSERT INTO TEST values (3,'s1')
select * from test
where empid not in (select empid from test where empcode not in ('s1','s2'))
regards,
prakash
---------------------------------------------------------------------------------
July 24, 2008 at 5:55 am
Thanks Pra,cheers
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply