Skip to content
Advertisement

function that allows grouping of rows

I’m using SQL Server Management Studio 2012. I have a similar looking output from a query shown below. I want to eliminate someone from the query who has 2 contracts.

Output

What I would like to see

Is there a function rather than Row_Number that allows you to group rows together so I can then use something like ‘where Row_Number not like 1 and 2’?

Advertisement

Answer

You can use HAVING as

Demo

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement