Re: Get last serial (autoincrement) value - Mailing list pgsql-php

From Bruno Wolff III
Subject Re: Get last serial (autoincrement) value
Date
Msg-id 20030901190122.GA1782@wolff.to
Whole thread Raw
In response to Get last serial (autoincrement) value  (Andrei Verovski (aka MacGuru) <andreil1@mail.starlett.lv>)
List pgsql-php
On Mon, Sep 01, 2003 at 13:34:32 +0300,
  Andrei Verovski <andreil1@mail.starlett.lv> wrote:
>
> Anyone knows how to obtain last inserted serial (autoincrement) id? I
> am currently using "SELECT id FROM table_name ORDER BY id DESC", and
> then retrieve first row and desired value.

How you want to do this, depends on what you what to do with the number.

Normally if you just inserted a record that would create a new id and you
want to use that id to enter in another table, then you want to call
currval.

pgsql-php by date:

Previous
From: Frank Bax
Date:
Subject: Re: Get last serial (autoincrement) value
Next
From: "Edric Bulalacao"
Date:
Subject: pg_connect problem