Hello there,
I have the following small table (CardTransactions), given below which is sorted by card and then by date:
CardNum ActivityDate
---------- -------------
1 2011/12/17
1 2011/12/18
1 2011/12/20
1 2011/12/22
2 2011/12/13
2 2011/12/16
2 2011/12/19
2 2011/12/22
3 2011/12/25
3 2011/12/30
3 2011/12/31
3 2011/12/31
What I'm wondering is if there is a SQL query that will do a DATEDIFF(for days) for only the 2 smallest dates on each card. The result of the query should show like this:
CardNum DateDiff
------- --------
1 1
2 3
3 5
Is it possible, please help.
Thanks
Neill
I have the following small table (CardTransactions), given below which is sorted by card and then by date:
CardNum ActivityDate
---------- -------------
1 2011/12/17
1 2011/12/18
1 2011/12/20
1 2011/12/22
2 2011/12/13
2 2011/12/16
2 2011/12/19
2 2011/12/22
3 2011/12/25
3 2011/12/30
3 2011/12/31
3 2011/12/31
What I'm wondering is if there is a SQL query that will do a DATEDIFF(for days) for only the 2 smallest dates on each card. The result of the query should show like this:
CardNum DateDiff
------- --------
1 1
2 3
3 5
Is it possible, please help.
Thanks
Neill