684
社区成员
发帖
与我相关
我的任务
分享
select a.deriveno, a.carno, to_char(a.actualtime,'yyyy-mm-dd hh24:mi:ss') as 开始时间,
select a.deriveno,
a.carno,
to_char(a.actualtime, 'yyyy-mm-dd hh24:mi:ss') as 开始时间,
to_char(a.actualtime, 'yyyy-mm-dd hh24:mi:ss') as 结束时间
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)

SELECT T1.DERIVENO, T1.CARNO, T1.RIDE_STARTTIME, T2.COMPLETEDT
FROM (SELECT DERIVENO, CARNO, actualtime RIDE_STARTTIME
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 in ('3','6')) T1
LEFT JOIN (SELECT DERIVENO, COMPLETEDT
FROM (select a.deriveno,
a.carno,
a.stagecode,
to_char(a.actualtime, 'yyyy-mm-dd hh24:mi:ss') as COMPLETEDT
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 in ('4','7')) T2
ON T1.DERIVENO = T2.DERIVENO
以前问过类似的,我在那个上面改了下。是不是