In general, it can be as follows:
But when there are multiple tables related and ordered by order, - selectrownum, afromA,BwhereA.a=B.border byA.a;
The rownum could be messed up.
In this case, you can use the analysis function rank() to implement:- selectrank() over(order byt.b) rowno, t.a, t.cfromtest torder byt.b;
In this way, you can both sort and automatically add consecutive serial numbers.
|