TSQL: finding unique entries in a single table

Posted by pcampbell on Stack Overflow See other posts from Stack Overflow or by pcampbell
Published on 2010-04-19T19:29:20Z Indexed on 2010/04/19 19:33 UTC
Read the original article Hit count: 344

Filed under:
|
|

Consider a table or CTE structured like this:

Name    Num
----    ----
Abc     12
Abc     12
XYZ     70
XYZ     80
Bar     50
Bar     55
Foo     44
Foo     44
Baz     88

The requirement is to determine the Name where multiple different Nums exist.

The desired resultset is

Name   
----
XYZ     
Bar     

What TSQL statement would you use to derive this resultset?

© Stack Overflow or respective owner

Related posts about tsql

Related posts about sql-server