mysql - ERROR 1064 near 'LEFT JOIN' -
i create 2 temporary tables , join them using following codes encounter error 1064 near 'left join'
.
(select distinct routes.route_short_name, min(stop_times.stop_sequence) first_stop, stops.stop_name first_stop_name trips join routes on ... join stop_times on ... join stops on ... join calendar on ... group stop_times.trip_id) first_table left join (select distinct routes.route_short_name, max(stop_times.stop_sequence) last_stop, stops.stop_name last_stop_name trips join routes on ... join stop_times on ... join stops on ... join calendar on ... group stop_times.trip_id) last_table on first_table.route_short_name = last_table.route_short_name;
the desired results like:
route_short_name, first_stop_name, last_stop_name ...
aren't missing actual main select statement?
select route_short_name, first_stop_name, last_stop_name --this part missing (select distinct ...) first_table left join (select distinct ...) last_table on first_table.route_short_name = last_table.route_short_name;
Comments
Post a Comment