On 1/14/2002 12:54 PM +0200 Markus Lervik wrote:

> Is there any way to combine INSERT...SELECT and INSERT INTO so
> one could insert a new row with a few values inserted by hand and
> others from another table? something like
> INSERT INTO mag_table (mag_id,issn,year,info,volume,numbers,remarks)
> VALUES  ( (SELECT id FROM mag_names WHERE mag_names.name="Asdf"),
> "1234-5678","2001","foobar","1-4","1-52","foobar");

Try doing something like:

INSERT INTO mag_table (mag_id,issn,year,info,volume,numbers,remarks)
        SELECT mag_names.id as mag_id,
                '1234-5678' as issn,
                '2001' as year,
                'foobar' as info,
                '1-4' as volume,
                '1-52' as numbers,
                'foobar' as remarks,
        FROM mag_names WHERE mag_names.name='Asdf';

I don't know if that will work as-is, but something along those lines 
should give you what you need.


Tobyn Baugher <[EMAIL PROTECTED]>

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to