Row numbers for a query in informix

后端 未结 6 2059
無奈伤痛
無奈伤痛 2020-12-19 11:15

I am using informix database, I want a query which you could also generate a row number along with the query

Like

select row_number(),firstName,lastN         


        
6条回答
  •  -上瘾入骨i
    2020-12-19 11:38

    You may not be able to use ROWID in a table that's fragmented across multiple DBSpaces, so any solution that uses ROWID is not particularly portable. It's also strongly discouraged.

    If you don't have a SERIAL column in your source table (which is a better way of implementing this as a general concept), have a look at CREATE SEQUENCE, which is more or less the equivalent of an Orrible function that generates unique numbers when SELECTed from (as opposed to SERIAL, which generates the unique number when the row is INSERTed).

提交回复
热议问题