Received: from web14603.mail.yahoo.com (web14603.mail.yahoo.com [216.136.224.83]) by postgresql.org (8.11.3/8.11.4) with SMTP id f7A3hLP06109 for ; Thu, 9 Aug 2001 23:43:21 -0400 (EDT) (envelope-from johny.q@rocketmail.com) Message-ID: <20010810034316.2823.qmail@web14603.mail.yahoo.com> Received: from [202.137.2.193] by web14603.mail.yahoo.com; Thu, 09 Aug 2001 20:43:16 PDT Date: Thu, 9 Aug 2001 20:43:16 -0700 (PDT) From: Johny Jugianto Subject: INSERT FOLLOW WITH OTHER INSERT To: pgsql-sql@postgresql.org In-Reply-To: <3B734DA7.29F0B8BE@tpf.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200108/142 X-Sequence-Number: 4363 hi all i have a table like this CREATE SEQUENCE seq_student_id INCREMENT 1 START 1; CREATE TABLE students ( student_id INT4 NOT NULL DEFAULT NEXTVAL('seq_student_id'), student_name text, student_address text, primary key(student_id) ) CREATE TABLE student_club ( student_id INT4 NOT NULL; club_id INT4, CONSTRAINT student_id_update FOREIGN KEY(student_id) REFERENCES students(student_id) ON UPDATE CASCADE ) my question is how i can make auto insert student_id on table student_club when i insert into table students example: INSERT INTO students(student_name) VALUES('Willy'); table STUDENT student_id | name | address --------------------------------- 1 | Willy | and on TABLE student_club student_id | club_id -------------------- 1 | i have trying with create rule and with check_foreign_key, but i haven't found solution. anyone can help me? Thanks in advance __________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/