Hello All
I have table with following fields:
GroupId VisitDate
1 10/19/1993
1 11/24/1998
2 10/18/1993
2 10/29/1998
3 10/21/1993
3 11/03/1998
4 10/25/1993
4 10/29/1998
4 04/29/1999
5 04/26/1994
5 03/29/1999
6 09/06/2001
7 09/07/1995
7 09/12/2000
In this table, I want to create a third field dynamically, where the
difference in date between the two visits for the same GroupId should
be displayed, so the output should be like this...
GroupId VisitDate Diff_VisitDate
1 10/19/1993 0
1 11/24/1998 5 Years
2 10/18/1993 0
2 10/29/1997 4 Years
3 10/21/1993 0
3 11/03/1998 5 Years
4 10/25/1993 0
4 10/29/1994 1 Year
4 04/29/1999 5 Years 6 Months
5 04/26/1994 0
5 03/29/1999 5 Years
5 03/28/2000 6 Years
6 09/06/2001 0
7 09/07/1995 0
7 09/12/2001 6 Years
So basically for the first VisitDate for every GroupId, Diff_VisitDate
should be 0 and for every successive VisitDate, this date should be
subtracted from the first VisitDate and displayed in Diff_VisitDate. Is
it possible to do this for a database of 3000 records?
Any help in this regard will be highly appreciated.
Thanks in advance.
Anita