I have 2 columns, the first is arrival_time, the second is pick_up, the question is the following, I need to sort the results depending on what type of service it is, if it is for example arrival (arrival) you have to select the schedule of the arrival_time column, if it is an exit or interhotel service you have to select your schedule from the pick_up column, and I need to sort them by time regardless of which service is, I'll give you an example of what I'm looking for
arrival 10:00
departure 10:15
11:00 departure
arrival 11:20
interhotel 11:50
The question is that if I order it for example so ORDER BY arrival_time ASC, pick_up ASC
if you order it, however it is sorted first by arrival_time and then by pick_up like this:
arrival 10:00
arrival 11:20
departure 10:15
11:00 departure
interhotel 11:50
How can I get the result I want? I searched for days on the internet and I can not find anything like that, in advance thank you very much for your support!
Here the complete query
SELECT name, pax, agency, origin, destination, internal_notes,
departure_flight, departure_date, arrival_date, arrival_flight,
TIME_FORMAT(arrival_time, '%H:%i') AS arrival_time, TIME_FORMAT(pick_up,
'%H:%i') AS pick_up, service_type FROM reservas WHERE arrival_date=? OR
departure_date=? ORDER BY pick_up, arrival_time ASC