Select the first row of each group in MYSQL

This solution depends on having a unique column you can order by. In the example it is “id”. You must have a unique column to use for ordering or else you could get more than one result per group.

SELECT m.* FROM mytable AS m JOIN (SELECT category, MIN(id) AS id FROM mytable GROUP BY category) AS t USING (id);