How to Add a Column to Sequentially Rank records?
Customer wants to assign a ranking number for each Row to only select, (for example) a customer's last three trips.
The Select is sorted by Customer Number, and each Date for that customer needs to have a 'RANK' starting at 1 like this example:
System ID Nbr | Arrive Cal Date | RANK | |
---|---|---|---|
101277627 | 3/13/14 | 1 | |
101277627 | 2/03/14 | 2 |
Need to use the RANK Function within the Query like so:
RANK( ) OVER(PARTITION BY SYIDTH ORDER BY HDARTH DESC) AS COLUMN0000
Still have questions? We can help. Submit a case to Technical Support.