Jump to content

SQL query to insert muliple records with different email address


Recommended Posts

Hi guys.

 

I have the following query

 

INSERT INTO `cork_wall`.`Classified` (
`id` ,
`user` ,
`description` ,
`link` ,
`img1` ,
`published`
)
VALUES (
NULL , 'corkdjs@gmail.com', 'Hi guys.', '', 'http://munsterweddingdjs.com/images/weddings-in-east-cork.jpg', '0'
);

 

how do i insert the same record multiple times but changing the email address each time to the following emails...

 

email1@hotmail.com

email2@hotmail.com

email3@hotmail.com etc

 

is there any quick way of doing it besides writhing out a different query for each email address?

just enclose the values with brackets and seperate with a comma

INSERT INTO `cork_wall`.`Classified` (
`id` ,
`user` ,
`description` ,
`link` ,
`img1` ,
`published`
)
VALUES (NULL , 'corkdjs@gmail.com', 'Hi guys.', '', 'http://munsterweddingdjs.com/images/weddings-in-east-cork.jpg', '0'),
(NULL , 'email2@gmail.com', 'Hi guys.', '', 'http://munsterweddingdjs.com/images/weddings-in-east-cork.jpg', '0'),
(NULL , 'email3@gmail.com', 'Hi guys.', '', 'http://munsterweddingdjs.com/images/weddings-in-east-cork.jpg', '0');

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.