Sort trips in query