method one:
This error is due to the default mode enabled in the new version of MySQL ONLY_FULL_GROUP_BY
, that is, in the GROUP BY
The SELECT list in the statement can only contain grouping or aggregation functions , and cannot contain other columns.
Method Two:
Obtain the latest time and address through the MAX function (because it needs to be grouped by address), and then use it as a table and the original data
To perform a joint search, the condition is that the address and time must be equal to the maximum time and address obtained.
reference:
Query the latest data after MySql grouping_mysql grouping latest data_Dadyage's Blog-CSDN Blog