count(*) over (partition by ……)用法详解_count over partition by
作者:知新_RL | 2024-03-15 13:12:26
赞
踩
count over partition by
select id,count(*) over(partition by pro_id) from sal;
以pro_id分组,统计分组后每个pro_id的记录总数及对应的id;
类似还有count(*) over(order by ……)、sum(amount) over(partition by ……)等,略有区别,挺有意思,有兴趣可以小研究下