max tries limit reached for insert query select
t.code,t.route,t.name,t.short_name,t.type, t.class, t.doo, t.description, ts1.day,
c1.name as origin,tso.code as origin_code, tso.name as origin_station,
c2.name as dest,tsd.code as dest_code, tsd.name as dest_station, ts1.depart_time,
ts1.delay as origin_delay, ts2.arrive_time,ts2.delay as dest_delay,
ADDTIME(TIMEDIFF(ts2.arrive_time, ts1.depart_time),
CONCAT((ts2.day-ts1.day)*24,':00:00')) as duration,
TIMEDIFF(ts1.depart_time, ts1.arrive_time) as origin_halt,
(ts2.distance-ts1.distance) as distance,
cts1.city_id,cts2.city_id,t.origin_id,t.dest_id,t.distance as total_distance,
t.pantry_car, t.tags
from
train_schedule ts1,train_schedule ts2,train t,train_station tso,
train_station tsd,city c1,city c2,train_station cts1, train_station cts2
where
t.class != 'NULL' and
tso.id = ts1.train_station_id and tsd.id = ts2.train_station_id
and ts1.stops=1 and ts2.stops=1 and ts1.train_id=ts2.train_id
and ts1.distance < ts2.distance and ts1.day <= ts2.day and ts1.route = ts2.route
and t.id=ts1.train_id and tso.city_id=c1.id and tsd.city_id=c2.id and cts1.id=t.origin_id
and cts2.id=t.dest_id and tso.city_id <> tsd.city_id and tso.city_id=%s
and tsd.city_id=%s and t.is_active = 1
order by t.code, tso.trains_passing desc, tsd.trains_passing desc, t.route;: [1618, 1648]