mysql将一张表的数据批量插入到另外一张表

2022年9月11日09:15:14

mysql如何将一张表的查询结果插入到另外一张表;

  1. 目标表与数据表,表结构一致
-- 复制并创建表createtable table_Bselect*from talbe_A;

INSERTINTO table_BSELECT*FROM table_A;
  1. 表结构不一致或从目标表获取部分字段
INSERTINTO table_B b(name,age)SELECT name,ageFROM table_A awhere a.id= b.id;
  • 作者:Robert-1
  • 原文链接:https://blog.csdn.net/syljoy/article/details/112979290
    更新时间:2022年9月11日09:15:14 ,共 206 字。