Search Postgresql Archives

Update with a Repeating Sequence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've got a table with repeated records that I want to make unique by adding a sequence code of 0,1,2,...,n for each set of repeated records. Basically, I want to turn:
field_id | seq
----------+-----
       1 |   0
       2 |   0
       3 |   0
       3 |   0
       3 |   0
       4 |   0
       4 |   0
       5 |   0
       6 |   0
into:
field_id | seq
----------+-----
       1 |   0
       2 |   0
       3 |   0
       3 |   1
       3 |   2
       4 |   0
       4 |   1
       5 |   0
       6 |   0

What's the best way to that?

TIA,
- Bill Thoen


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux