34,587
社区成员
发帖
与我相关
我的任务
分享
select *
from CollectInfo a
where not exists (select 1 from CollectInfo b
where a.RoadID=b.RoadID
and convert(datetime, a.CollectDate+' '+a.CollectTime)<convert(datetime, b.CollectDate+' '+b.CollectTime)
)
select *
from road a
where not exists (select 1 from road b
where a.RoadLine=b.RoadLine
and convert(datetime, a.CollectDate+' '+a.CollectTime)<convert(datetime, b.CollectDate+' '+b.CollectTime)
)
select * from CollectInfo A where A.CollectID in (select top 1 B.CollectID from CollectInfo B where B.RoadId = A.RoadId order by B.CollectDate desc,B.CollectTime desc)