SELECT distinct state, machine FROM states order by machine, state assuming your table is called 'states'
SELECT distinct state, machine FROM states order by machine, state
Forum Rules