Re: [GENERAL] Numbering rows by date

2008-04-08 Thread Andrus
Volkan, > CREATE SEQUENCE document_docorder_seq START 1; > > UPDATE document > SET docorder = T.docorder > FROM (SELECT nextval('document_docorder_seq') AS docorder, docdate > FROM document > ORDER BY docdate) AS T > WHERE document.docdate = T.docdate; > > DROP SEQUENCE documen

Re: [GENERAL] Numbering rows by date

2008-04-06 Thread Volkan YAZICI
On Wed, 2 Apr 2008, "Andrus" <[EMAIL PROTECTED]> writes: > create Document ( docdate date, docorder integer ) > > I need update docorder column with numbers 1,2 in docdate date order > Something like > > i = 1; > UPDATE Document SET docorder = i++ > ORDER BY docdate; CREATE SEQUENCE document_doc

Re: [GENERAL] Numbering rows by date

2008-04-06 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Andrus" <[EMAIL PROTECTED]> writes: > I have table > create Document ( docdate date, docorder integer ) > I need update docorder column with numbers 1,2 in docdate date order > Something like > i = 1; > UPDATE Document SET docorder = i++ > ORDER BY docdate; >

Re: [GENERAL] Numbering rows by date

2008-04-05 Thread brian
Andrus wrote: I have table create Document ( docdate date, docorder integer ) I need update docorder column with numbers 1,2 in docdate date order Something like i = 1; UPDATE Document SET docorder = i++ ORDER BY docdate; How to do this is PostgreSQL 8.2 ? ALTER TABLE DROP COLUMN docord

[GENERAL] Numbering rows by date

2008-04-05 Thread Andrus
I have table create Document ( docdate date, docorder integer ) I need update docorder column with numbers 1,2 in docdate date order Something like i = 1; UPDATE Document SET docorder = i++ ORDER BY docdate; How to do this is PostgreSQL 8.2 ? Andrus. -- Sent via pgsql-general mailing li