今年第一天
1.sql语句
SELECT DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL dayofyear(now())-1 DAY),'%Y-%m-%d') AS c_year
2.结果
去年第一天
1.sql语句
SELECT DATE_FORMAT((DATE_SUB((DATE_SUB(NOW(),INTERVAL dayofyear(now())-1 DAY)),INTERVAL 1 YEAR)),'%Y-%m-%d') AS last_year
2.结果