日期:2014-05-20 浏览次数:20851 次
select d.Plate,b.TerminalSign,b.[Longitude],b.[Latitude],b.[speed],b.[direction],b.[FullOrEmpty],b.[AccStyle],b.[GpsTime],e.Name
from [TaxiRadarHistory].[dbo].TaxiRdHistorydata_20131210 as b
right join (select [TerminalSign],max(GpsTime) as GpsTime from [TaxiRadarHistory].[dbo].TaxiRdHistorydata_20131210 where GpsTime>dateadd(mi,-600,getdate()) group by TerminalSign) as a
on b.TerminalSign=a.TerminalSign and b.GpsTime=a.GpsTime
left join TR_Device as c on a.TerminalSign=c.DeviceNum
left join TR_Car d on c.DeviceID=d.Phone and d.IsScrapped=0
left join TaxiRdDriverLogin e on b.TerminalSign=e.TerminalSN
where e.LoginOut is null and e.LoginIn<b.GpsTime and b.TerminalSign='0867493010086303'