postgresql行號類似oracle rownum效果

使用窗口函數row_number()


select row_number() OVER (ORDER BY id) as rownum ,* from score;


如果不關心排序,可以這樣select row_number() over() as rownum,* from score;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章