34,590
社区成员
发帖
与我相关
我的任务
分享
select * from tb a where GpsID_i = (select max(GpsID_i) from tb where (Inputtime_t between '2012-01-19 8:30' and '2012-01-19 22:30:00') AND CarID_i =a.CarID_i )
with t as
(
select *,
row_number() over(partition by CarID_i order by Inputtime_t desc) rn
from tab
)
select *
from t where rn=1
select * from tb
where not exists(select 1 from tb where cardid=t.card_id and inputtime_t>t.inputtime_t)
select *
from tb t
where not exists(select 1 from tb where CarID_i=t.CarID_i and Inputtime_t>t.Inputtime_t)
select * from tablename t
where Inputtime_t=(select max(Inputtime_t) from tablename where CarID_i=t.CarID_i)
select * from t1 a
where not exists(select 1 from t1 where a.Inputtime_t<Inputtime_t and a.CarID_i=CarID_i)
select * from (select *,
row_number() over(partition by CarID_i order by Inputtime_t desc) rid
from 表) a where rid=1