I have a problem where i have a simple sql query as displayed below:
Select
Ah_editime as todaysdate,
(CONVERT(VARCHAR(25), DATEADD(dd, -(DAY(GETDATE()) - 1), GETDATE()), 103)) AS monthstartdate,
(CONVERT(VARCHAR(10), CAST(GETDATE() AS DATE), 103)) AS monthcurrentdate
from
Transaction
where
Ah_editime BETWEEN (CONVERT(VARCHAR(25), DATEADD(dd, -(DAY(GETDATE()) - 1), GETDATE()), 103))
AND (CONVERT(VARCHAR(10), CAST(GETDATE() AS DATE), 103))
I want to display result only for current month to till date. But the problem that I face is I get the values from past month as well which creates issues. I have a report that displays the values.
Here if you see I am getting all the values but I want for the current month only.
P.S : Can that be the format issue? todaysdate
that is getting displayed which is my actual value.