Mysql records the latest three days in the table, how to write SQL statements to mysql records the latest three days in the table, and how to write SQL statements. I checked one from the Internet, but this is based on the current time as the starting point to take the records of the last few days select & nbsp; * & nbsp; from & nbsp; rewards & nbsp; where & n mysql takes the three-day record of "latest" in the table, and how to write SQL statements
Mysql fetch table
LatestHow to write SQL statements for a three-day record. I checked one from the Internet, but this is
Start from the current time to get the last few daysSelect * from rewards where DATE_SUB (CURDATE (), INTERVAL 4 DAY)
<= Date (day) order by day desc MySQL shared:
------ Solution --------------------
Try
Select * from tt inner join
(Select date (day) as 'day' from tt group by date ('day') order by 'day' desc limit 3)
On date (tt. day) = a. day