Last Insert

Поиск
Список
Период
Сортировка
Искать
От
Marcelo Pereira
Тема
Last Insert
Дата
Msg-id
Pine.LNX.4.20.0203131106080.12082-100000@ni.hmmg.sp.gov.br
Список
Дерево обсуждения
Last Insert Marcelo Pereira <gandalf@sum.desktop.com.br>
Re: Last Insert Stephan Szabo <sszabo@megazone23.bigpanda.com>
Re: Last Insert Steve Lane <slane@fmpro.com>
Re: Last Insert Martijn van Oosterhout <kleptog@svana.org>
Re: Last Insert Steve Lane <slane@fmpro.com>
Re: Last Insert Martijn van Oosterhout <kleptog@svana.org>
Re: Last Insert Steve Lane <slane@fmpro.com>
Re: Last Insert "Peter Darley" <pdarley@kinesis-cem.com>
Re: Last Insert Darren Ferguson <darren@crystalballinc.com>
Hello All,

I have two tables, the first is parental and the second is a child of the
first.

Ex.:

create table first (id SERIAL, descrip CHAR(20));
create table second (id INTEGER references first(id), state CHAR(2));

I have `all' the values to make the inserts in the two tables (ie, descrip
and state), so I `would' use:

INSERT into first (descrip) values ($descr);
INSERT into second (id,state) values (?????????,$state);

As you can see, I don't know the ID number assigned to first.id, so I
can't do the INSERT in the `second' table...

How can I discover the number gave to the SERIAL field in the first table?

Thanks in advance,

Marcelo

В списке pgsql-general по дате отправления
От: Darren Ferguson
Дата:
Сообщение: Re: Modifying text data?
От: Aaron Couts
Дата:
FAQ