I have written the following query to query a database:
SELECT `year` AS "Year",
country_Name AS "Country",
avg_mon_temp AS "Max Temperature"
FROM world_temps
LEFT JOIN countries
ON world_temps.country_Code = countries.country_Code
#GROUP BY `year`, country_Name
This returns approx 5000 rows of data in the following format:
Data Set
How can return the MAXIMUM temperature per year. For instance, I only want the highest temperature for 1901, then the highest for 1902, and so on.
2
Answers
Seems you just need to use
GROUP BY
ANDMAX
to do ityou can try for: