I have a problem about custom date range. let me explain it, for our company month count from current month day 21 to next month day 20. if i want to know which employee join current month then normally i can find using sql
SELECT *
FROM tblEmployeeMaster
--CURRENT MONTH
WHERE MONTH(DateOfJoining)=MONTH(GETDATE()) AND YEAR(DateOfJoining)=YEAR(GETDATE())
but for this custom date range i can not find employee who are join in this month. For example in this system if i want to find list of employee joined in this month then result will be show that employee who join in previous month after day 21 to current month day 20. Could someone please help me?
In this example, this month’s period is considered to be from 21 of the previous month to 20 of current month, employees in that period are considered to be this month’s employees (all who came to company after 2012-05-21 until 2012-06-20 (including 2012-06-20)). Try it: