sql获取某类数据最新时间的值


平时解决这种,总是用group by,但是又不能select * ,为了可以select * ,于是采用如下办法:

select *
from (select t.*,
row_number() over(partition by t.name order by t.changedate desc) num
from a1_resource_statistics_cache t) a
where num = 1
order by no asc;

参考文章:

http://blog.csdn.net/dotnetstudio/article/details/9766177

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM