As shown above, the mysql database in the background stores data one by one. When querying, it is arranged in reverse by date and takes 30 records. The front desk will display the data by date, and how to handle the data to be displayed at the front desk.
To put it simply, your requirement is to arrange the records backwards by time, and then aggregate multiple records in the returned results according to coarse-grained time (e.g. daily). This has little to do with data storage, so you can save it as you like. It’s just a matter of how to aggregate records when processing the display.
The most intuitive method is to pull out the data, and then the application will display the records belonging to the same day in the same column according to the coarse-grained time. As for how to display, it is entirely a matter of the front end.
SQL can be roughly written as follows:
Select time, DATE_FORMAT(time,’ percentage Y- percentage m- percentage d’), date, othercolumns
order by time desc;
Then the same date records in the query results are displayed together.
I don’t know if the above can meet your needs.