Php mysql grouping statistics takes the maximum and lowest values of the first and last pieces of data in the grouping.

now the data structure is like this
field id price amount time (format is 2018-07-11 10:15 format)
now the demand is like this,
groups time
in minutes, and then take the first and last price data in the group and the minimum value of amount (this I know to use max and min)
but what to read the first and last data in the price packet, and whether there is a direct MYSQL syntax to get

.
Apr.01,2021

the first line of grouping is sorted and then grouped, and what is taken out is the first grouping. Adjust the sorting method to get the last item. It should be impossible to get the first and last item at the same time


if you meet all the above requirements at the same time, it is impossible. The general advice is to use Php. If you want to use sql, price can be obtained using limit 1, the last item can be obtained using order by desc limit 1, or you can use the syntax of the framework to get more simple

.
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-1e518c9-4497d.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-1e518c9-4497d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?