利用row_numer() over (partition filed order by filed),进行同类排序
select t2.name,
t2.subject,
t2.point,
row_number() over(partition by t2.name order by t2.point) rn
from dwcn_ext.test_score t2
rn为同类序列号
SQL窗口函数实战
本文介绍如何使用SQL中的row_number()窗口函数对特定字段进行同类排序。通过具体实例演示了如何结合partition by和order by子句来实现数据的有效组织与排序。
利用row_numer() over (partition filed order by filed),进行同类排序
select t2.name,
t2.subject,
t2.point,
row_number() over(partition by t2.name order by t2.point) rn
from dwcn_ext.test_score t2
rn为同类序列号
1万+
5512

被折叠的 条评论
为什么被折叠?