我想知道是否有一种方法可以纯粹在 sql 中执行此操作:
q1 = SELECT campaign_id, from_number, received_msg, date_received FROM `received_txts` WHERE `campaign_id` = '8'; INSERT INTO action_2_members (campaign_id, mobile, vote, vote_date) VALUES(q1.campaign_id, q1.from_number, q1.received_msg, q1.date_received);
注意: q1 将返回大约 30k 行。
有什么方法可以在直接 sql 中执行我在上面尝试的操作吗?直接从一个表(基本上是原始数据表)中提取数据并插入另一个表(基本上是处理过的数据表)?
INSERT INTO action_2_members (campaign_id, mobile, vote, vote_date) SELECT campaign_id, from_number, received_msg, date_received FROM `received_txts` WHERE `campaign_id` = '8'