Re: Same field different values
- From: markc600@xxxxxxxxxxx
- Date: Mon, 23 Jul 2007 08:14:40 -0700
-- Query 1
select Field1
from table1
group by Field1
having sum(case when Field2 not in ('A','B') then 1 else 0 end)=0
-- Query 2
select Field1
from table1
group by Field1
having sum(case when Field2='A' then 1 else 0 end)>0
and sum(case when Field2='B' then 1 else 0 end)>0
.
- References:
- Same field different values
- From: gelangov
- Same field different values
- Prev by Date: Re: MS SQL Express Advanced vs MS SQL full version vs MySQL
- Next by Date: Scripting schema and data together - SQL Server
- Previous by thread: Same field different values
- Next by thread: Re: Same field different values
- Index(es):