mysql> SELECT DATE_SUB(LAST_DAY(NOW() - INTERVAL 1 MONTH),INTERVAL DAY(LAST_DAY(NOW() - INTERVAL 1 MONTH))-1 DAY);
+-----------------------------------------------------------------------------------------------------+
| DATE_SUB(LAST_DAY(NOW() - INTERVAL 1 MONTH),INTERVAL DAY(LAST_DAY(NOW() - INTERVAL 1 MONTH))-1 DAY) |
+-----------------------------------------------------------------------------------------------------+
| 2016-08-01 |
+-----------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT DATE_SUB(LAST_DAY(NOW()),INTERVAL DAY(LAST_DAY(NOW()))-1 DAY);
+---------------------------------------------------------------+
| DATE_SUB(LAST_DAY(NOW()),INTERVAL DAY(LAST_DAY(NOW()))-1 DAY) |
+---------------------------------------------------------------+
| 2016-09-01 |
+---------------------------------------------------------------+
1 row in set (0.00 sec)
+-----------------------------------------------------------------------------------------------------+
| DATE_SUB(LAST_DAY(NOW() - INTERVAL 1 MONTH),INTERVAL DAY(LAST_DAY(NOW() - INTERVAL 1 MONTH))-1 DAY) |
+-----------------------------------------------------------------------------------------------------+
| 2016-08-01 |
+-----------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT DATE_SUB(LAST_DAY(NOW()),INTERVAL DAY(LAST_DAY(NOW()))-1 DAY);
+---------------------------------------------------------------+
| DATE_SUB(LAST_DAY(NOW()),INTERVAL DAY(LAST_DAY(NOW()))-1 DAY) |
+---------------------------------------------------------------+
| 2016-09-01 |
+---------------------------------------------------------------+
1 row in set (0.00 sec)
No comments:
Post a Comment