Hi James,

In MySQL you could use "select last_insert_id()" to get the insert id of table 1 and use that as the fk in table 2.

In Postgresql I think it is a bit more complicated. Something like:

SELECT CURRVAL(pg_get_serial_sequence('my_tbl_name','id_col_name'));

On Wed, Jan 19, 2011 at 2:11 PM, James Nzomo <kazikubwa@gmail.com> wrote:
That's what i usually do but i want to know if there is a more efficient way to set the foreign key on insert

_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke



--
Regards

Brian Ngure