I am fighting with the distinct keyword in sql. I just want to display all row numbers of unique (distinct) values in a column & so I tried:
sql
distinct
Try this:
;WITH CTE AS ( SELECT DISTINCT id FROM table WHERE fid = 64 ) SELECT id, ROW_NUMBER() OVER (ORDER BY id) AS RowNum FROM cte WHERE fid = 64