select tab_a.车辆号,tab_a.X,tab_a.Y from tab_a, tab_b, (select tab_a.车辆号,max(tab_a.time) from tab_a, tab_b where tab_a.车辆号 = tab_b.车辆号 and tab_b.on = '在线' group by tab_a.车辆号 ) as tab_c where tab_a.车辆号 = tab_b.车辆号 and tab_a.车辆号 = tab_c.车辆号 and tab_b.on = '在线'
where tab_a.车辆号 = tab_b.车辆号 and tab_a.车辆号 = tab_c.车辆号 and tab_b.on = '在线'
您给的语句,从A、B、C三表中查数据,满足条件的全都会出来,在结果集合汽车的多个轨迹都被查出来了,而不是最新的