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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 doubled data

Author  Topic 

Winnie99
Starting Member

1 Post

Posted - 2012-02-09 : 18:02:55
Hi everybody

i have ONE table containing following data

A B
P1 S1
P1 S3
P2 S1
P2 S2

I now want to select string1-data which dont contain 'S3'.
The answer is obviously 'P2'.
Can somewone out there help me??

Thanks Jenny

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-02-09 : 18:06:38
[code]
SELECT A
FROM table
GROUP BY A
HAVING SUM(CASE WHEN B='S3' THEN 1 ELSE 0 END) = 0

[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -