SELECT stop_reference, service_id, distance FROM table ORDER BY service_id, distance;