Skip to content
Advertisement

Is there a way to group rankings in SQL Teradata?

I am trying to get the ranking or grouping to count like in the custom_ranking column:

enter image description here

I want it to count the rank like in the row custom_ranking, but everything I keep trying is counting it in the current_ranking row.

I am currently using this:

,row_number() OVER (partition by custID, propID  ORDER BY trans_type desc, record_date desc) AS RANKING

Advertisement

Answer

Based on your sample data, this would be:

dense_rank() over (partition by custid order by propid)
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement