Home > Enterprise >  Generate an auto increment number in select query increase by 2
Generate an auto increment number in select query increase by 2

Time:10-07

I need to generate auto increment number in a select query but increase by 2. so it should look like following

Column1    Column2      Sequence
some Value some Value   2
some Value some Value   4
some Value some Value   6

I tried ROW_NUMBER but didn't find any option to increase the number by 2. I'm using PostgreSQL

Thanks in advance for your help!!

CodePudding user response:

select * , row_number() over () * 2
from table;
  • Related