Query data according to time

requirement: when the data is saved, the time type used is timestamp, so the current insertion time is automatically saved. Then I need to count the data I inserted, and count it by time period. First, show all the months in which the data exists, click the month to show the date on which the data exists in this month, and then click the date to show the details of the specific number of data stored on that day. If there is data in July and September, but there is no data in August, August will not be displayed. By the same token, if there is no data and no display on a certain day in a certain month, the expression may be a little complicated, but the implementation should be relatively simple. I don"t know how to design it, and whether to extract all the data at once, or only part of it, and if the data is divided by date.
my development environment is that the front end uses vue, and the back end uses PHP

Sep.01,2021

for php, each execution is independent. If you do not use session, cookie, memcached, redis and other cached data, it is no different for you to take out a large range and filter it in php at one time, and narrow it down and retrieve it again every time.

so if you want to take out a large area at a time, you should consider caching.

if the number of visits is small, it doesn't matter if you don't cache it. It costs a little more to access the database each time, but you don't have to consider caching Synchronize and other problems.

if you have a large number of visitors, you must use caching, and there are more issues to consider.

in short, it has something to do with the size of your project.


php develops several APIs:
1. Query monthly statistics of a certain year

a.
b.php  sql :
    select (),count(*) as dataCount
    from 
    group ()
    where ()
c.

2. Query the statistical data of a certain day (similar)
3. Query the details of the data of a certain day

.
where
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3cd9e-2c33d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3cd9e-2c33d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?