Mysql 获取前30天日期

SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL ac DAY), '%Y-%m-%d') as date
FROM (
SELECT @ai:=@ai+1 as ac from
(SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5) ac1,
(SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6) ac2,
(SELECT @ai:=0) xc0
) ad

上一篇:C++之联合体


下一篇:web干货