$ 0 0 DISTINCT is processed after ROW_NUMBER which creates unique values :-) You need to move the DISTINCT into a Derived Table: SELECT ROW_NUMBER(....), dt.* FROM ( SELECT DISTINCT ... FROM ...) AS dt Dieter
DISTINCT is processed after ROW_NUMBER which creates unique values :-)
You need to move the DISTINCT into a Derived Table:
Dieter