Link to home
Start Free TrialLog in
Avatar of Cole100
Cole100Flag for United States of America

asked on

Need a date expression for current pay period

I am building a query to pull data for the current pay period. My pay periods run from the 1st to 15th, 16th to last day of month. Example: if today is any date between the 2nd to the 16th it would pull the data from the first pay period and if it was and date between the 17th to the 1st it would pull data from the second pay period.
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

What fields to you have in your table?
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Cole100

ASKER

perfect. thank you

SELECT dbo_Daily_Service_Catg_Tb.Service_Category, dbo_Daily_Service_Catg_Tb.Service_Category_Qty_Sold, dbo_Daily_Service_Catg_Tb.Service_Category_Sales_Amt
FROM dbo_Daily_Service_Catg_Tb
WHERE (((dbo_Daily_Service_Catg_Tb.Store_Number)=2881) AND ((dbo_Daily_Service_Catg_Tb.Operations_Day)>=DateSerial(Year(Date()),Month(Date()),IIf(Day(Date())<16,1,16))) AND (([dbo_Daily_Service_Catg_Tb.Operations_Day])<DateSerial(Year(Date()),Month(Date())+IIf(Day(Date())<16,0,1),IIf(Day(Date())<16,16,0))))
GROUP BY dbo_Daily_Service_Catg_Tb.Service_Category, dbo_Daily_Service_Catg_Tb.Service_Category_Qty_Sold, dbo_Daily_Service_Catg_Tb.Service_Category_Sales_Amt
HAVING (((dbo_Daily_Service_Catg_Tb.Service_Category) In ("tir","spp","brk")));

Open in new window

glad I could help.