Select Row number in postgres

前端 未结 1 1103
北海茫月
北海茫月 2020-12-07 19:27

How to select row number in postgres.

I tried this:

select
    row_number() over (ORDER BY cgcode_odc_mapping_id)as rownum,
    cgcode_odc_mapping_id
          


        
相关标签:
1条回答
  • 2020-12-07 20:18
    SELECT tab.*,
        row_number() OVER () as rnum
      FROM tab;
    

    Here's the relevant section in the docs.

    P.S. This, in fact, fully matches the answer in the referenced question.

    0 讨论(0)
提交回复
热议问题