How to use Loops

Teradata Applications
Enthusiast

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???

Tags (1)
2 REPLIES
Enthusiast

Re: How to use Loops

Please Help me guys !!

Teradata Employee

Re: How to use Loops

Have you thought about using row_number?

ROW_NUMBER() OVER (PARTITION BY col1,col2.... order by col1)