I have a recordset that comes back with duplicate customers because of purchase date. Since the dates vary i need to translate the duplicates out into columns. I want to rank the duplicates by date and only take 5 duplicates?
Normally in teradata i would use a CSUM() or RANK() function to create a derived table to translate out that keeps track of the number of duplicates. Is there a way to do this in SQL Server 2000?
i.e.
customer date prod rank
cust1 1/1/2000 prod1 1
cust1 4/4/2004 prod2 2
cust1 6/5/2004 prod8 3
I can take the above table and translate out using case statements, but i don't know how to generate the rank column
Thanks,
Jon
Normally in teradata i would use a CSUM() or RANK() function to create a derived table to translate out that keeps track of the number of duplicates. Is there a way to do this in SQL Server 2000?
i.e.
customer date prod rank
cust1 1/1/2000 prod1 1
cust1 4/4/2004 prod2 2
cust1 6/5/2004 prod8 3
I can take the above table and translate out using case statements, but i don't know how to generate the rank column
Thanks,
Jon