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

Checking sequence of numbers and populate a flag if number is out of sequence - response (7) by mohan.mscss

$
0
0
The below query will work with duplicates along with null values if we have it in File number too.. sel    Serial_Number,    Send_Date ,    Count(*)  as File_Count ,    Case When ( Max_Seq - Min_Seq ) = File_Count-1 Then ' No'  Else 'YES' END as Non_Seq_Flag,    Min (File_Number) as  Min_Seq,    max( File_Number) as Max_Seq from  ( sel distinct serial_number,send_date,zeroifnull(File_number) as File_number from <<sourcetable>>)dt group by   Serial_Number,   Send_Date Regards, Mohan K  

Viewing all articles
Browse latest Browse all 14773

Trending Articles