Page 1 of 1

How to insert multiple rows in one single query??

Posted: Mon Mar 02, 2009 4:14 am
by shubham.amola
I want to insert multiple rows in a table in one single query. Insert query is working when i have to insert single row but when it comes to insert multiple rows its taking the value of last rows...

this is the query i am using

INSERT INTO [table]
( [field1], [field2], [field3] ) VALUES
( '[value1.1]', '[value1.2]', '[value1.3]' ),
( '[value2.1]', '[value2.2]', '[value2.3]' ),
( '[value3.1]', '[value3.2]', '[value3.3]' ),


Any suggestions

Re: How to insert multiple rows in one single query??

Posted: Thu Mar 19, 2009 2:36 am
by jaoudestudios
You dont need the last comma (,).

Examples
http://dev.mysql.com/doc/refman/5.1/en/insert.html