multiple INSERT

multiple INSERT

am 25.04.2006 13:03:30 von Wesley

Can i make multiple inserts into a table using one statement.
the statement:
INSERT INTO table1 (UserName) VALUES (SELECT DISTINCT UserName FROM
table2)

Basically, i want to take out all the UserNames from table2 and insert
them into table1.
It doesnt work, why?
Thanks Wes

Re: multiple INSERT

am 25.04.2006 19:16:20 von Bill Karwin

wesley@ispace.co.za wrote:
> Can i make multiple inserts into a table using one statement.
> the statement:
> INSERT INTO table1 (UserName) VALUES (SELECT DISTINCT UserName FROM
> table2)

This one trips me up from time to time. Take out the word 'VALUES'.

Refer to syntax documented here:
http://dev.mysql.com/doc/refman/5.0/en/insert.html

Regards,
Bill K.