Teradata SQL - Data ranking

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
Visitor

Teradata SQL - Data ranking

I have to produce ranking as per last column using combination of Column 2 and Column3. What should i use ??

 

ABBRDESCLVL_UP_CDEI NEED THIS ORDERING
PUPERSONAL990011
PNPERSONAL990011
MNPERSONAL990011
KKWDNG990012
VCVACATION990013
PUPERSONAL990024
MNPERSONAL990024
ZNPERSONAL990024
AAHOTEL990035
ACHOTEL990046
BCHOTEL990046
MMMOBILE990047
TTTELEPHONE990048

Accepted Solutions
Teradata Employee

Re: Teradata SQL - Data ranking

It appears to be DENSE_RANK() OVER (ORDER BY LEVEL_UP_CDE, "DESC") if you can tolerate the ordering PERSONAL=1, VACATION=2, WDNG=3. Otherwise you need to map the "DESC" values to something that can be sorted in the desired order.

1 ACCEPTED SOLUTION
1 REPLY
Teradata Employee

Re: Teradata SQL - Data ranking

It appears to be DENSE_RANK() OVER (ORDER BY LEVEL_UP_CDE, "DESC") if you can tolerate the ordering PERSONAL=1, VACATION=2, WDNG=3. Otherwise you need to map the "DESC" values to something that can be sorted in the desired order.