with a as( select uid,city,event_time as dt,1 as flag from tb_get_car_record union select uid,city,end_time as dt,-1 as flag from tb_get_car_record where order_id is null union (select t.uid,city,ifnull(start_time,finish_time) as dt,-1 as flag from tb_get_car_order t right join tb_get_car_record tr ...