470,591 Members | 1,471 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

multiple INSERT

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

Apr 25 '06 #1
1 1463
we****@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.
Apr 25 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by RotterdamStudents | last post: by
10 posts views Thread by shank | last post: by
3 posts views Thread by DarthMacgyver | last post: by
5 posts views Thread by Arsen V. | last post: by
10 posts views Thread by ads | last post: by
2 posts views Thread by Diego | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.