我正在尝试提取过去 7 天的记录。这是我一直试图开始工作的选择声明:
select from_unixtime(time,'%m/%d/%y') as fdate, from_unixtime(time,'%h:%m:%s') as ftime
from mdl_log
where from_unixtime(time,'%y-%m-%d') between curdate() and curdate() - INTERVAL 7 DAY
我尝试了 where 子句的各种化身,例如
where time between curdate() and curdate() - INTERVAL 7 DAY
和
where from_unixtime(time,'%yyyy-%mm-%dd') between curdate() and curdate() - INTERVAL 7 DAY
和
where date(time) between curdate() and curdate() - INTERVAL 7 DAY
选择 curdate() - 以这种格式显示日期 2012-11-08