In my db, I have a column, ‘Transaction Date’ with datetime datatype. For instance, ‘2011-05-31 00:00:00.000’.
I would like to create a SQL Query by selecting data with whereby the ‘Transaction Date’ column date is one month before the @InputDate.
I have tried with…
DATEADD(MONTH,-1,@InputDate) and it returns ’30-May-2011′, which is not what i want!
I want the value returns will always be the last day of the month like ’31-May-2011′
Last day of same month
Last day of last month