如何对 MYSQL 进行多次插入,每次插入都基于子查询中一组值中的每个值?

How to do multiple inserts into MYSQL, each insert based on each value in a set of values from a subquery?

我正在尝试在整个网站上传播一组评论,看来我需要为每个产品插入一次评论。所以,我有 100 种产品,我需要进行一次评论并将其插入 100 次,每件产品一次,这样评论就会出现在网站的各个地方(有点像 Etsy 的做法)。但是,我该怎么做呢?

(本系统基于woocommerce。)

我会尝试以下我尝试过的代码(所有 variable/column 名称都是正确的,但我很确定这不是应该设置此类查询的方式。),但是我很确定它会失败(看起来太清晰了,无法正常工作)所以有人能给我一个正确方向的提示吗?

INSERT INTO wp_comments
SET comment_author = 'britney',
comment_date = '2015-11-07 07:55:02',
comment_date_gmt = '2015-11-07 07:55:02',
comment_content= 'the comment',
comment_approved = '1',
comment_parent = '0',
user_id = '2',
post_id = t.id FOR ALL ID IN
(select ID
FROM wp_posts
WHERE post_type = 'product') as t;

你会想要这样做:

INSERT INTO wp_comments (
            comment_author,
            comment_date,
            comment_date_gmt,
            comment_content,
            comment_approved,
            comment_parent,
            user_id,
            post_id)
SELECT      'britney',
            '2015-11-07 07:55:02',
            '2015-11-07 07:55:02',
            'the comment',
            '1',
            '0',
            '2',
            id 
FROM        wp_posts
WHERE       post_type = 'product';