Hi SImon

Try this

INSERT INTO
               table1
SELECT
               12 as fixedvalue1 , 20 as fixedvalue2 ,table2.A , table2.B
FROM
               table2

WHERE
              table2.id = 10

First the SELECT Query is executed from the table 2 which has  id = 10
The Result would be something like this

fixedvalue1    fixedvalue2    table2.A         table2.B
12                 20                 'A'                    'B'
12                 20                 'AA'                'BB'


Then these values are inserted in table 1


----- Original Message -----
From: "Simon Green" <[EMAIL PROTECTED]>
To: "'Mysql (E-mail)'" <[EMAIL PROTECTED]>
Sent: Thursday, July 18, 2002 3:51 PM
Subject: INSERT SELECT and VALUES


>
> > Hi All
> > I am trying to copy data from one table to another using in MySQL
> > INSERT INTO  table1
> > SELECT table2
> > statment but I would like to add some fixed values to this and so some
> > thing like.
> > INSERT INTO table1
> > SELECT table2
> > VALUES ('A','B');
> > But I can not find if this can be done or how....
> > Thanks
> > Simon
>
> ---------------------------------------------------------------------
> 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

Reply via email to