Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Generating Sequence Number when GROUP BY in the Query - response (2) by dnoeth

$
0
0

Hi Sagar,
of course you can use RANK and aggregates in the same query, OLAP functions are calculated after GROUP BY/HAVING.
You probably use the deprecated RANK(col) instead of RANK() OVER (ORDER BY col DESC):

select col, sum(col2) as sumcol2, rank() over (order by sumcol2) 
from tab 
group by 1;

 


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>