Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
06-07-2011, 09:10 PM #1
- Join Date
- Jun 2009
- Thanked 0 Times in 0 Posts
SQL query to insert muliple records with different email address
I have the following query
INSERT INTO `cork_wall`.`Classified` (
NULL , 'email@example.com', 'Hi guys.', '', 'http://munsterweddingdjs.com/images/weddings-in-east-cork.jpg', '0'
is there any quick way of doing it besides writhing out a different query for each email address?
Last edited by kevinkhan; 06-07-2011 at 09:23 PM.
06-07-2011, 09:49 PM #2
The best you can do is provided by MySQL (only) via:
That is, you simply repeat the insert values, in parens, once for each set of values you want to insert.Code:INSERT INTO table ( field1, field2, field3 ) VALUES ( x, y, z ), ( a, b, c ), ( .... )
I don't know of any other DB that allows this, so you are lucky you are using MySQL.