oracle sql 重复记录 只显示一条 ,显示 时间最近 或id 最大,同时显示其他列

 
 
挑选出number最大的
select * 
from biao b 
where not exists(select * from biao where b.name=name and b.number<number)
order by id desc
 
 
 
 
 
 
挑选出时间最近的
select * 
from biao b 
where not exists(select * from biao where b.name=name and b.eventtime<eventtime
)
order by id desc


 
发布了45 篇原创文章 · 获赞 1 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/oSiJieMo/article/details/39501863