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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -