How to get latest record for the same customer

Tools

How to get latest record for the same customer

How to get latest record for the same customer

2) if suppose in the customer id 10 i have 100 records. how to pick the latest,oldest record for that particular id 10. please give me SQL query in teradata

3) second question is how to give the ranks for all records without using rank function

kanisetti srinivasarao
2 REPLIES

Re: How to get latest record for the same customer

hi, your table i think has the date creation. if it has u can use the function maximum or mininum to get the latest or old record.

Re: How to get latest record for the same customer

If the Customer ID is an identity column - I mean if it's not randomly generated - then simply use Max & Min.
Use ROW_NUMBER if your Customer ID is unique... it'll give the same Rank...