mysql get last 12 months data code example
Example 1: mysql get last day of month
SELECT LAST_DAY(CURDATE()); -- Current month
SELECT LAST_DAY(CURDATE() - INTERVAL 1 MONTH); -- Previous month
SELECT LAST_DAY(CURDATE() + INTERVAL 1 MONTH); -- Next month
Example 2: mysql last 6 months
.... where yourdate_column > DATE_SUB(now(), INTERVAL 6 MONTH)