Page 1 of 1

second day transaction date of customer

Posted: Tue Dec 08, 2009 1:19 am
by sridinesh2009
Find the second day transaction amount for a Accnt_id.

Ex: Epected records are marked in red.
Acct_Hist
Accnt_id, Trans_Dt, Seq_Num
1001 23-10-09 1
1001 24-10-09 1
1001 25-10-09 1
1002 26-10-09 1
1002 27-10-09 1
1002 27-10-09 2

1002 28-10-09 1

Output:
Accnt_id, Trans_Dt ,Seq_Num
1001 24-10-09 1
1002 27-10-09 1
1002 27-10-09 2

Posted: Tue Dec 08, 2009 3:16 am
by ray.wurlod
Welcome aboard.

If your data are sorted, then this is a straightforward application of using stage variables to compare the current row with the previous row.

However, the logic in your example does not appear to match your words.

Posted: Tue Dec 08, 2009 3:18 am
by Sainath.Srinivasan
An exactly identical query was answered couple of days ago.

Posted: Tue Dec 08, 2009 6:54 am
by chulett
As noted, your example doesn't match what you say you need, nor is there any red that I can see. Why is there a record for 24-10-09 in the output? :?