Groupwise Max in MariaDB
The problem
Sample data
+------------------+----------------+------------+
| province | city | population |
+------------------+----------------+------------+
| Saskatchewan | Rosetown | 2309 |
| British Columbia | Chilliwack | 51942 |
| Nova Scotia | Yarmouth | 7500 |
| Alberta | Grande Prairie | 41463 |
| Quebec | Sorel | 33591 |
| Ontario | Moose Factory | 2060 |
| Ontario | Bracebridge | 8238 |
| British Columbia | Nanaimo | 84906 |
| Manitoba | Neepawa | 3151 |
| Alberta | Grimshaw | 2560 |
| Saskatchewan | Carnduff | 950 |
...Duplicate max
Using an uncorrelated subquery
Using @variables
The duds
Top-N in each group
Top-n in each group, take II
Top-n using MyISAM
Windowing functions
Postlog
See also
Last updated
Was this helpful?

