678
社区成员




select t1.deriveno, t1.carno, t1.begintime, t2.endtime
from (select deriveno, carno, actualtime begintime
FROM (select a.deriveno,
a.carno,
a.stagecode,
to_char(a.actualtime, 'yyyy-mm-dd hh24:mi:ss') as actualtime
from app_carstatus a, app_send b
where a.deriveno = b.deriveno
and b.status in ('0', '10')
and b.deriveno not in (select deriveno from app_ridecost))
where stagecode = '3') t1
left join (select deriveno, actualtime endtime
from (select a.deriveno,
a.carno,
a.stagecode,
to_char(a.actualtime, 'yyyy-mm-dd hh24:mi:ss') as actualtime
from app_carstatus a, app_send b
where a.deriveno = b.deriveno
and b.status in ('0', '10')
and b.deriveno not in
(select deriveno from app_ridecost))
WHERE STAGECODE = '4') t2
on t1.deriveno = t2.deriveno