Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
csu
Starting Member
2 Posts |
Posted - 2010-07-16 : 17:59:01
|
Table A has the following records:No Desc.1 , A1 , B1 , C2 , A2 , B3 , A3 , CI need to get the following:2 (only the No that don't have C under the desc.)Thanks for any suggested query |
|
singularity
Posting Yak Master
153 Posts |
Posted - 2010-07-16 : 19:23:40
|
select distinct nofrom yourtable awhere not exists (select * from yourtable b where b.desc = 'C' and a.no = b.no) |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-07-19 : 07:20:59
|
orselect no from tablegroup by nohaving sum(case when desc='c' then 1 else 0 end)=0MadhivananFailing to plan is Planning to fail |
 |
|
csu
Starting Member
2 Posts |
Posted - 2010-07-19 : 09:28:27
|
Thanks, that did the job for me. |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-07-19 : 10:13:21
|
quote: Originally posted by csu Thanks, that did the job for me. 
No problem MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|