| 7 | |
| 8 | {{{#!sql |
| 9 | SELECT lf.name, lt.name, trip.free_seats, trip.date, t_o.company_name, stop_time |
| 10 | FROM ticket as tick |
| 11 | JOIN trip on trip.trip_id = tick.trip_id |
| 12 | JOIN transport_organizer as t_o ON trip.transport_organizer_id = t_o.transport_organizer_id |
| 13 | JOIN route as r ON trip.route_id = r.route_id |
| 14 | JOIN location as lf on r.from_location_id = lf.location_id |
| 15 | JOIN location as lt on r.to_location_id = lt.location_id |
| 16 | JOIN trip_stops as stop on lf.location_id = stop.location_id |
| 17 | WHERE tick.account_id = {account_lists_id}; |
| 18 | }}} |
| 19 | |
| 23 | |
| 24 | {{{#!sql |
| 25 | SELECT lf.name, lt.name, trip.free_seats, trip.date, t_o.company_name, stop_time |
| 26 | FROM ticket as tick |
| 27 | JOIN trip on trip.trip_id = tick.trip_id |
| 28 | JOIN transport_organizer as t_o ON trip.transport_organizer_id = t_o.transport_organizer_id |
| 29 | JOIN route as r ON trip.route_id = r.route_id |
| 30 | JOIN location as lf on r.from_location_id = lf.location_id |
| 31 | JOIN location as lt on r.to_location_id = lt.location_id |
| 32 | JOIN trip_stops as stop on lf.location_id = stop.location_id |
| 33 | WHERE tick.account_id = {account_lists_id} |
| 34 | AND status = {selected_status} |
| 35 | AND (trip.date < {before_date} AND trip.date < {after_date}) |
| 36 | AND t_o.company_name = {selected_company_name}; |
| 37 | }}} |
| 38 | |