我想知道是否有一种方法可以完全在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将返回约3万行。
有什么办法可以在直式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'