34,587
社区成员
发帖
与我相关
我的任务
分享
--设表名为t
select a.* from t a,(select item_id,max(utime) utime from t group by item_id) b
where a.item_id=b.item_id and a.utime=b.utime
(.人.)
( 。人 。)
仅供参考,
select item_ID, max(utime), max(price) from item_price group by item_ID,utime
select * from
tb t1 where utime in
(
select max(t2.utime) from tb t2 where t1.item_ID=t2.item_ID
)
select * from
tb t where not exists
(
select 1 from tb where t.item_ID=item_ID and t.utime<utime
)