select   PerInfo.*,RGD.*,DV.* from (select *  from dbo.G_PersionInfo g where 1=1 and GpsID<>'' )PerInfo
left join
(
select d.*  from dbo.Device  d 
where  not exists
(
   select 1  from  dbo.Device  where  GpsID=d.GpsID and  ID>d.ID
)
)DV
on  PerInfo.GpsID=DV.GpsID
left join
(
select  r.*  from dbo.ReceiveGpsData r
where not exists
(
   select 1 from  dbo.ReceiveGpsData where GpsID=r.GpsID and ID>r.ID
)
)RGD
on  PerInfo.GpsID=RGD.GpsID
posted on 2010-11-05 17:27  挑战自我  阅读(253)  评论(0编辑  收藏  举报