Of course this is not correct, you use two columns in the ORDER BY, but the MIN(STATE) is only a single column.
Go to Harpeet's link and change the code to the 2nd version based on ROW_NUMBER() OVER (ORDER BY STATE, COALESCE(columnA, 'Other'))
And better keep the outer join, otherwise you'll get a different result :-)
Dieter
Of course this is not correct, you use two columns in the ORDER BY, but the MIN(STATE) is only a single column.
Go to Harpeet's link and change the code to the 2nd version based on
ROW_NUMBER() OVER (ORDER BY STATE, COALESCE(columnA, 'Other'))
And better keep the outer join, otherwise you'll get a different result :-)
Dieter