how to insert more than one item with INSERT INTO
Feb 19th, 2008 22:31
dman, Matt Chatterley, Tamas Boss, http://sturly.com
It depends very much on what you want to do.
If you're only putting in values:
INSERT INTO table1 (col1, col2) VALUES (1, 4);
Then theres no really easy way, short of writing a script in
PHP/language of your choice which will generate a list of queries for you.
If you are getting the data from another table (or query), you can
insert as many rows at once as you want:
INSERT INTO table1 (col1, col2)
SELECT col1, col2 FROM table2 WHERE col3 = 7;