数据
A B C
----------------------------
a 10 x
a 20 x
a 30 x
b 30 x
b 40 x
b 10 x
按A分组,B排序,得出id列
结果
id A B C
1 a 10
2 a 20
3 a 30
1 b 10
2 b 30
3 b 40
------解决思路----------------------
select row_number() over(partition by A order by B) as id,A,B,C from tablename