Re: insert subquery

2005-09-24 Thread Pooly
2005/9/23, Gordon Bruce [EMAIL PROTECTED]: What am I missing INSERT INTO table1 (column names.) SELECT VALUES.. FROM table2 WHERE primary id = insert value You will have to put in your real table name and column names. nice and easy :-) -- Pooly Webzine Rock :

Re: insert subquery

2005-09-23 Thread SGreen
DJ [EMAIL PROTECTED] wrote on 09/23/2005 12:22:58 PM: i want to insert a row into table1 only if the value being inserted on table1 exists on table2 primary id. can i do this with subquery? thanx. -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version:

Re: insert subquery

2005-09-23 Thread DJ
[EMAIL PROTECTED] wrote: DJ wrote on 09/23/2005 12:22:58 PM: i want to insert a row into table1 only if the value being inserted on table1 exists on table2 primary id. can i do this with subquery? thanx. Depending on what version MySQL you are using, probably not. A very robust

Re: insert subquery

2005-09-23 Thread SGreen
DJ [EMAIL PROTECTED] wrote on 09/23/2005 12:49:35 PM: [EMAIL PROTECTED] wrote: DJ wrote on 09/23/2005 12:22:58 PM: i want to insert a row into table1 only if the value being inserted on table1 exists on table2 primary id. can i do this with subquery? thanx. Depending

RE: insert subquery

2005-09-23 Thread Gordon Bruce
, 2005 11:59 AM To: DJ Cc: mysql@lists.mysql.com Subject: Re: insert subquery DJ [EMAIL PROTECTED] wrote on 09/23/2005 12:49:35 PM: [EMAIL PROTECTED] wrote: DJ wrote on 09/23/2005 12:22:58 PM: i want to insert a row into table1 only if the value being inserted on table1 exists on table2

RE: insert subquery

2005-09-23 Thread SGreen
: Friday, September 23, 2005 11:59 AM To: DJ Cc: mysql@lists.mysql.com Subject: Re: insert subquery DJ [EMAIL PROTECTED] wrote on 09/23/2005 12:49:35 PM: [EMAIL PROTECTED] wrote: DJ wrote on 09/23/2005 12:22:58 PM: i want to insert a row into table1 only if the value being

Re: insert subquery

2005-09-23 Thread Shankar Unni
[EMAIL PROTECTED] wrote: Well, Gordon, looks like you missed the thread. ;-) Maybe, but his solution is actually pretty close to what the OP wanted Instead of INSERT INTO Table1 (...) VALUES ('val1', 'val2', 'val3', ...) something you do INSERT INTO Table1 (...) SELECT 'val1',