17,086
社区成员
发帖
与我相关
我的任务
分享
select COL1 ,COL2 , COL3 ,row_number() over(partition by col1 order by col2) cn1,
decode(row_number() over(partition by col1 order by col2),1,dense_rank over (order by col1),null) cn2
from table
select COL1 ,COL2 , COL3 ,row_number() over(partition by col1 order by col2) cn1,
decode(row_number() over(partition by col1 order by col2),1,count(*) over (partition by col1),null) cn2
from table