mysql get last month 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 get last 2 month data
SELECT * FROM d_jobs WHERE `job_date` >= last_day(now()) + interval 1 day - interval 3 month;