Update with a Repeating Sequence - Mailing list pgsql-general

From Bill Thoen
Subject Update with a Repeating Sequence
Date
Msg-id 48F4C317.4040305@gisnet.com
Whole thread Raw
Responses Re: Update with a Repeating Sequence  ("Grzegorz Jaśkiewicz" <gryzman@gmail.com>)
Re: Update with a Repeating Sequence  (Steve Atkins <steve@blighty.com>)
List pgsql-general
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


pgsql-general by date:

Previous
From: "Francisco Figueiredo Jr."
Date:
Subject: Re: Why select 1 where current_date = 'infinity'; doesn't work?
Next
From: "Grzegorz Jaśkiewicz"
Date:
Subject: Re: Update with a Repeating Sequence