Dear All,
i need help on the following regard,
in Table T1 the fields are as follows,
C1........C2.........C3.......C4
1 .........a ..........
1 .........b .........
1 .........c...........
a .........1a........
a...........1b........
b..........2a.........
2..........x.......
2 ..........y.......
Now need to extract distinct values of C1, which is not present with C2, like the result shud show,
1
2
alone. the a, b shud not come with my result as it is been with C2.
how can i achieve it?
Plzzz help me.....
Hi,
try this
create table #ABC (C1 char(2),C2 char(2))
insert into #ABC values('1','a')
insert into #ABC values('1','b')
insert into #ABC values('1','b')
insert into #ABC values('a','1a')
insert into #ABC values('a','1b')
insert into #ABC values('b','2a')
insert into #ABC values('2','x')
insert into #ABC values('2','y')
select a.c1 from #ABC as a
where a.c1 not in (select b.c2 from #ABC as b group by b.c2)
group by a.C1
RESULT
c1
1
2
ARUN SAS
🙂
April 4, 2009 at 4:39 am
HI Arun Thks for ur reply tht trick works Thks a Lot txtPost_CommentEmoticon(':-)');
🙂
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply