Forum Moderators: open

Message Too Old, No Replies

Adding multiple rows

to mysql db

         

stef25

1:44 pm on Mar 12, 2006 (gmt 0)

10+ Year Member



id like to add about 300 rows to a table and also into multiple columns with one statement. adding one row at a time like this works

INSERT INTO my_table
VALUES ('netherlands', 'default')

but this doesnt

INSERT INTO my_table
VALUES ('netherlands', 'default')
VALUES ('poland', 'default')

and neither does this

INSERT INTO my_table
VALUES ('netherlands', 'default')
INSERT INTO my_table
VALUES ('poland', 'default')

anyone know how to?

txbakers

2:42 pm on Mar 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



INSERT INTO mytable VALUES ('row1val1','row1val2'),('row2val1','row2val2'),('row3val1','row3val2')

Each set of values has to be in a parentheses, separated by comma.

Give that a try.