select dat.id,
dat.voucher_id,
dat.type,
dat.state,
dat.start_point,
dat.start_floor,
dat.end_point,
dat.end_floor,
dat.box_no,
dat.node_str,
dat.task_type
from dis_agv_task dat
inner join (select dar.task_id, dar.car_id
from (select dar.task_id, dar.car_id
from dis_agv_route dar
where dar.car_id = #{carId}
order by dar.created_time desc) dar
where rownum = 1) dar
on dat.id = dar.task_id
where dat.state = #{state}
转载于:https://www.cnblogs.com/austinspark-jessylu/p/9101223.html