当前位置:Gxlcms > PHP教程 > mysql取表中《最新》三天的记录,sql语句如何写

mysql取表中《最新》三天的记录,sql语句如何写

时间:2021-07-01 10:21:17 帮助过:5人阅读

mysql取表中《最新》三天的记录,sql语句怎么写
mysql取表中最新三天的记录,sql语句怎么写。从网上查了一条,但这是以当前时间为起点取最近几天的记录select * from rewards where DATE_SUB(CURDATE(), INTERVAL 4 DAY)
<= date(day) order by day desc MySQL

分享到:


------解决方案--------------------
try
select * from tt inner join
(select date(day) as `day` from tt group by date(`day`) order by `day` desc limit 3) a
on date(tt.day)=a.day

人气教程排行