not so sequential sequences

From: "Rhys Stewart" <rhys(dot)stewart(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: not so sequential sequences
Date: 2006-10-17 21:18:51
Message-ID: 189966030610171418v30b3fc23haa726f163ecdd409@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all, looking for a method to number a table sequentially, but the
sequence only increments if the value in a certain column is
different. as in

seq | parish
------------------------
1 | Kingston
1 | Kingston
1 | Kingston
1 | Kingston
2 | Lucea
3 | Morant Bay
3 | Morant Bay
3 | Morant Bay
4 | Port Antonio
5 | Savannah-La-Mar
5 | Savannah-La-Mar
5 | Savannah-La-Mar

so i guess i would order by a certain column and then the 'magic
sequence' would be a column that only increments when the column
changes.

Rhys

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2006-10-17 21:25:44 Re: exploiting features of pg to obtain polymorphism
Previous Message Jeff Davis 2006-10-17 21:15:23 Re: [GENERAL] Database users Passwords