Given a table with columns(name, lat, lon, population, type)
where there are many rows for each name, I'd like to select the rows grouped by name where population is the highest. The following works if I restrict myself to just name and population
SELECT name, Max(population)
FROM table WHERE name IN ('a', 'b', 'c')
GROUP BY name;
But I want the other columns — lat, lon, type
— as well in the result. How can I achieve this using SQLite?