Okay guys and help/advice/suggestion would be greatly appreciated. I hope this explanation I sufficient
I have a user form which requires the user to dictate a STARTDATE and ENDDATE,I also have the user have the option to dictate a STARTSTEPDATE and ENDSTEPDATE field. I need to be able to calculate all the steps between the STARTDATE and ENDDATE. So what I want it to do is make a list of the steps.. an Example would be below. This example has the step defined as being 1.5 months however it could very easily be by decade, year, two year group etc.
User inputs as follows
STARTDATE : 01/01/1990
ENDDATE : 03/01/2006
STARTSTEPDATE : 01/01/1990
ENDSTEPDATE : 02/15/1990
I’m trying to get it to make the query output something along the lines of
STEPSTART STEPEND PKEY
01/01/1990 02/15/1990 1
01/01/1991 02/15/1991 2
01/01/1992 02/15/1992 3
01/01/1993 02/15/1993 4
01/01/1994 02/15/1994 5
01/01/1995 02/15/1995 6
01/01/1996 02/15/1996 7
01/01/1997 02/15/1997 8
01/01/1998 02/15/1998 9
01/01/1999 02/15/1999 10
01/01/2000 02/15/2000 11
01/01/2001 02/15/2001 12
01/01/2002 02/15/2002 13
01/01/2003 02/15/2003 14
01/01/2004 02/15/2004 15
01/01/2005 02/15/2005 16
01/01/2006 02/15/2006 17
I can do this programmatically (VB/VBA) but I’m trying to do it in SQL and seem to be chasing my tail.
Thanks
-eric
I have a user form which requires the user to dictate a STARTDATE and ENDDATE,I also have the user have the option to dictate a STARTSTEPDATE and ENDSTEPDATE field. I need to be able to calculate all the steps between the STARTDATE and ENDDATE. So what I want it to do is make a list of the steps.. an Example would be below. This example has the step defined as being 1.5 months however it could very easily be by decade, year, two year group etc.
User inputs as follows
STARTDATE : 01/01/1990
ENDDATE : 03/01/2006
STARTSTEPDATE : 01/01/1990
ENDSTEPDATE : 02/15/1990
I’m trying to get it to make the query output something along the lines of
STEPSTART STEPEND PKEY
01/01/1990 02/15/1990 1
01/01/1991 02/15/1991 2
01/01/1992 02/15/1992 3
01/01/1993 02/15/1993 4
01/01/1994 02/15/1994 5
01/01/1995 02/15/1995 6
01/01/1996 02/15/1996 7
01/01/1997 02/15/1997 8
01/01/1998 02/15/1998 9
01/01/1999 02/15/1999 10
01/01/2000 02/15/2000 11
01/01/2001 02/15/2001 12
01/01/2002 02/15/2002 13
01/01/2003 02/15/2003 14
01/01/2004 02/15/2004 15
01/01/2005 02/15/2005 16
01/01/2006 02/15/2006 17
I can do this programmatically (VB/VBA) but I’m trying to do it in SQL and seem to be chasing my tail.
Thanks
-eric