平時解決這種,總是用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