MySQL如何获取指定时间段内的所有日期
SELECT DISTINCTdate_format(DATE_ADD('2018-08-20',INTERVAL id DAY),'%Y-%m-%d') AS `TIME`FROMsys_logWHEREDATE_ADD('2018-08-20',INTERVAL id DAY) <= '2018-08-26'ORD...
·
SELECT DISTINCT
date_format(
DATE_ADD(
'2018-08-20',
INTERVAL id DAY
),
'%Y-%m-%d'
) AS `TIME`
FROM
sys_log
WHERE
DATE_ADD(
'2018-08-20',
INTERVAL id DAY
) <= '2018-08-26'
ORDER BY time
表名为任意表,数量够多即可
更多推荐
已为社区贡献1条内容
所有评论(0)