是否有oracle语句可以解决我的问题?
。表a有2列:columnA and columnB
ColumnA ColumnB
-------------------
A WA
A WA
B WA
B WA
C WA
A CA
A CA
B CA
B CA
C CA
我想要的是:自动号码Group by ColumnA
Auto ColumnA ColumnB
-----------------------
1 A WA
2 A WA
3 A CA
4 A CA
1 B WA
2 B WA
3 B CA
4 B CA
1 C WA
2 C CA
可以使用ROW_NUMBER函数。按列分组,并指定一些排序子句
SELECT ROW_NUMBER () OVER (PARTITION BY columnA ORDER BY columnB) as "auto",
columnA, columnB
FROM table;