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 : http://w
[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', ...)
you do
INSERT INTO Table1 (...)
SELECT 'val1', 'val2', 'val3',
al Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: 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
, 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 t
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?
> >>
> >>
[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
m
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.
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: 7.0.344 / Virus Database: 267.11.5/110 - Release Date: 9/22/2005
--