MySQL Forums
Forum List  »  Newbie

Re: combined Insert/Select statement
Posted by: Felix Geerinckx
Date: June 14, 2005 08:33AM

Robert Branham wrote:

> > INSERT INTO foo SELECT NULL, 'fee', 'faa', d
> > FROM
> > bar;
>
> Felix how does this help Jeroen's original question of inserting from both a table and an
> external parameter?

Well, you only have to substitute 'fee' or 'faa' with an external parameter, and d is coming from a table.
How you do that depends on the programming language, which the OP didn't mention.

In Perl, e.g. one could write:

$dbh->prepare("INSERT INTO foo SELECT NULL, ?, ?, d FROM bar");

and then write

my $fee = 'fee'; my $faa = 'faa';
$dbh->execute($fee, $faa);

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Written By
Posted
Re: combined Insert/Select statement
June 14, 2005 08:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.