SELECT TSL_DTE,LOGDATE,subdate(TSL_DTE,interval 31 day) TSL_DTE_PM, date_sub(LOGDATE,interval 1 month) LOGDATE_PM
TSL_DTE = '2009-06-30';
The problem in this query is, if I inputted a date of month which ends 30 day then the previous month is consist of 31 day it gives an output of 1 month interval which is 2009-05-30( it should be 2009-05-31). What I need is to get the end of day of the each month.
Can anyone could help me in getting out in this problem.
| TSL_DTE | TSL_DTE_PM | LOGDATE_PM |
|2009-06-30 |2009-05-30 | 2009-05-30 |
This post has been edited by bischmarck: 25 October 2009 - 11:20 PM