select row_number() over (order by <field> nulls last) as rownum,* from foo_tbl order by <field>
如果订单没有必要,这个答案也可以简化:
select row_number() over(),* -- notice: no fields are needed from foo_tbl
select row_number() over (order by <field> nulls last) as rownum,* from foo_tbl order by <field>
如果订单没有必要,这个答案也可以简化:
select row_number() over(),* -- notice: no fields are needed from foo_tbl