All Forums Teradata Applications
09 Apr 2016
How to use Loops

Hi All ,
I have my table like this :
Id Name Country
1   Vaibhav India
2    Amit     UK
3     Pranav  US
 
I want to read all the records by the max number of records present using  count(id) ,3 in this case  and just increment the counter by 1 for each records processed .Simultaneously i wanted to print the result of my counter variable.
Can anyone suggest how to do it???
 

09 Apr 2016

Please Help me guys !!
 

TDobiee 9 posts Joined 07/09
13 Apr 2016

Have you thought about using row_number?
 
ROW_NUMBER() OVER (PARTITION BY col1,col2.... order by col1)

You must sign in to leave a comment.