SQL将附属表的数据移动至主表操作
2019-11-08 本文已影响0人
HAO延WEI
业务需求:
两张同样字段不同表名的数据表,表table_B为表table_A的附属表,由于业务需求,要将附属表的内容移动至主表,进行合并
"""
语法
"""
INSERT INTO table_A (`column_a`, `column_b`) SELECT `column_a`, `column_b` FROM table_B;
"""
实例
"""
INSERT IGNORE into
askbob_option_relation(engine_id,option_id,relation_type,relation)
select
engine_id,option_id,relation_type,relation
from
new_4600;