I'm using mysql. And here is one table, which I made for example:
In this table I've got fields:
Country
, City
, Resource
, Volume
, other
I need to SELECT records which contains MAX value of Volume
field of each Resource
each City
each Country
.
I've tried these query:
SELECT `Country`, `City`, `Resource`, MAX(`Volume`), `other`
FROM `temp`
GROUP BY `Country`, `City`, `Resource`
but data was messed up (at field 'other').
To be clear that's what I'm trying to achieve.
I need the WHOLE record, which contains MAX Volume
value.
I've already read SQL Select only rows with Max Value on a Column and know that there is a INNER JOIN - way to solve that but don't get, how to do it with multiple grouping. Thank you for reading.