Consider a table or CTE, structured as follows:
Name Num ---- ---- Abc 12 Abc 12 XYZ 70 XYZ 80 XYZ 85 Bar 50 Bar 55 Foo 44 Foo 44 Baz 88
The requirement is to define a Name where several different Nums exist.
Desired result set
Name ---- XYZ Bar
Which TSQL statement would you use to get this result set?
Update: indeed, there can be 2+ entries for this name.
source share