INSERT INTO 2 JOINED TABLES

2001-02-06 Thread Hardi Gunawan

As an example to my problem, I have 2 tables, T1 and
T2.

T1's fields are Common,T1Field1,T1Field2 (Common is
the primary key and it is autoincrement)
T2's fields are T2Field1,Common,T2Field2 (T2Field1 is
the primary key)

I created a view using "SELECT
T1.T1Field1,T1.T1Field2,T2.T2Field1,T2.T2Field2 FROM
T1 T2 WHERE T1.Common = T2.Common)".

How do I create the INSERT SQL in this case? The Field
"Common" is not yet filled, because it is
autoincremented. So I cannot insert into table T2.

Anyone can help me? Thank you.


__
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: INSERT INTO 2 JOINED TABLES

2001-02-06 Thread Rolf Hopkins

I thought this would have been relatively easy.

INSERT into T1 VALUES ...

then

INSERT into T2 VALUES ...

and no, you can't insert into 2 tables with 1 insert statement unless the
mysql team fixed that with the latest version.


- Original Message -
From: "Hardi Gunawan" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 06, 2001 22:06
Subject: INSERT INTO 2 JOINED TABLES


 As an example to my problem, I have 2 tables, T1 and
 T2.

 T1's fields are Common,T1Field1,T1Field2 (Common is
 the primary key and it is autoincrement)
 T2's fields are T2Field1,Common,T2Field2 (T2Field1 is
 the primary key)

 I created a view using "SELECT
 T1.T1Field1,T1.T1Field2,T2.T2Field1,T2.T2Field2 FROM
 T1 T2 WHERE T1.Common = T2.Common)".

 How do I create the INSERT SQL in this case? The Field
 "Common" is not yet filled, because it is
 autoincremented. So I cannot insert into table T2.

 Anyone can help me? Thank you.


 __
 Do You Yahoo!?
 Yahoo! Auctions - Buy the things you want at great prices.
 http://auctions.yahoo.com/

 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php