I have a Condition in my query , where I need a Report on Monthly basis.If the Date is =01/01/2012 then, I need the date till Today, like this:
If the date is :12/01/2011(Prevoius Month)
I need whole month, since the date is passed. But if I select this month, it should show for 4 days(since today is: 01/04/2012).
I had condition like this in my where clause, which gets only Month and Year.
WHERE datepart(mm,users.[datetime]) = datepart(mm,@dt)
And datepart(yy,users.[datetime]) = datepart(yy,@dt)
NOTE: Here @dt is the temp variable, to pass value.