id | priority | group | name --------------------------------- 1 | 10 | a | test test 2 | 20 | a | moo 3 | 10 | b | fish === select group,name from table order by priority group by group results in a | test test b | fish