I am using SQL Row_Number to get a raking column;
ROW_NUMBER() OVER(PARTITION BY PolicyRef@ ORDER BY di.Create_date,di.Create_time_hh,di.Create_time_mm) as [Rank]
However I need to reverse the order. I've tried adding in Asc but that doesn't seem to make any difference?!
PolicyRef@ is varchar(255), Create_Date is a datetime, but with the time part all as 00.00.00.000, Create_Time_hh is a number (this is the hour in the day the record was created, but stored as 09, 17 etc) and Create_Time_mm is also a number (this is the minut in the day the record was created, but again stored as 19, 57 etc).
Why can I not reorder this in the usual way?
Thanks
DESC.ASCis the default sort order (also: which DBMS are you using?)