I have a table that records the mailing list subscriptions for subscribers.
CREATE TABLE IF NOT EXISTS `subscriber_list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`subscriber_id` int(11) NOT NULL,
`account_id` int(11) NOT NULL,
`list_id` int(11) NOT NULL,
`date_entered_gmt` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `subscriber_id_account_id_list_id` (`subscriber_id`,`account_id`,`list_id`),
KEY `list_id_account_id` (`list_id`,`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1454722 ;
In the application, which uses the table, there is function that allows all subscribers within a mailing list to be subscribed to another.
I was going to use a subquery to get all the current subscribers of the mailing list that will be subscribed to the new selected mailing list and some how with this list of subscribers insert a new mailing list record for each defining the new subscription but the mailing list can reach up to 250,000 subscribers so I am not sure how this should be done.
Cheers
Marc
You can use INSERT … SELECT something like this –
In response to your comment I have updated the values in this query. This will –
and insert them straight into the subscriber list table. So, if the values in the SELECT are those that you want to insert this will suit your scenario.