RichardOneil
MIS
Good Afternoon -
I have a table that lists pay date by payroll. What I need to get is a list of the all the dates that fall within a pay period. Pay dates are every two weeks, so I am able to reliably capture the starting point of each pay period. Here is my code thus far:
It returns:
PAYROLL 08/27/07 09/10/07
PAYROLL 09/11/07 09/24/07
I need it to return:
PAYROLL 08/27/07 09/10/07
PAYROLL 08/28/07 09/10/07
PAYROLL 08/29/07 09/10/07
PAYROLL 08/30/07 09/10/07
...up to
PAYROLL 09/10/07 09/10/07
then start the sequence over on the next pay date
PAYROLL 09/11/07 09/24/07
PAYROLL 09/12/07 09/24/07
PAYROLL 09/13/07 09/24/07
PAYROLL 09/14/07 09/24/07
My guess is that this is a relatively easy thing to do but I am still a SQL newb, so Thanks in advance for the assist.
I have a table that lists pay date by payroll. What I need to get is a list of the all the dates that fall within a pay period. Pay dates are every two weeks, so I am able to reliably capture the starting point of each pay period. Here is my code thus far:
Code:
Select payroll,
DateAdd("d",0-13,checkdate) AS FROMDATE,
checkdate AS THRUDATE
From PpPayrollScheduleDictionary
Where active='Y' and DateDiff("m",checkdate,getdate())<18
Order by payroll,checkdate
It returns:
PAYROLL 08/27/07 09/10/07
PAYROLL 09/11/07 09/24/07
I need it to return:
PAYROLL 08/27/07 09/10/07
PAYROLL 08/28/07 09/10/07
PAYROLL 08/29/07 09/10/07
PAYROLL 08/30/07 09/10/07
...up to
PAYROLL 09/10/07 09/10/07
then start the sequence over on the next pay date
PAYROLL 09/11/07 09/24/07
PAYROLL 09/12/07 09/24/07
PAYROLL 09/13/07 09/24/07
PAYROLL 09/14/07 09/24/07
My guess is that this is a relatively easy thing to do but I am still a SQL newb, so Thanks in advance for the assist.