SELECT * FROM ( SELECT ROWNUMBER() OVER (PARTITION BY emp.jobtitle) FROM Employee emp ) DerivedTable WHERE DerivedTable.RowNumber < 2
CarlSaiyed wrote: » Order by isn't allowed within the CTE declaration but it is allowed with the temp table