SQL中隔行编号的操作

一般在sql中进行排序编号的时候都是:

row_number() over(order by xxx)

但是有时候某些行不想让他们参与排序,这时候可以:

row_number() over(order by(case when xxx then xxx else null end))

注意case when是写在order by函数中

猜你喜欢

转载自www.cnblogs.com/stAr-1/p/12305762.html