From: | Marcelo Pereira <gandalf(at)sum(dot)desktop(dot)com(dot)br> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Last Insert |
Date: | 2002-03-13 14:14:31 |
Message-ID: | Pine.LNX.4.20.0203131106080.12082-100000@ni.hmmg.sp.gov.br |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Dan Langille | 2002-03-13 14:15:58 | Re: Field Constraints |
Previous Message | Lee Kindness | 2002-03-13 13:53:35 | Export a database or a table from a database |