SQL Query DatePart Case question
Posted on 2015-01-26
I have the following tables that has the following:
Fields: CustID, BillingFrequencyID
What I need to do is I am going to get passed a parameter @PeriodEndDate. I need to filter the list of Customers based on does that Date fall into the Billing Frequency. Such as lets say I get passed:
12/31/14 that would mean I would want all customers where BillingFrequency IN (1, 2, 4) it falls on the last day of the month, last day of quarter and last day of the year.
If it is 1/23/14 - then no data would return
If 1/31/15 then where BillingFrequency = 1 as its just a Month End.
How can I use date parsing to get the data correct?