MySQL将表a中查询的数据插入到表b中

假设表b存在

insert into b select * from a;

假设表b不存在

create table b as select * from a;

扩展:

将b表中的某写字段值插入到a表中

insert into a (userID,userName) select b.userID,b.userName from tr_ajax_chat_messages;

将a表和b表userID相等的值保存到a表

update a set a.userName=(select b.userName from b where a.userID = b.userID);


相关文章:

  • 2022-12-23
  • 2021-06-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2021-08-19
  • 2022-02-26
猜你喜欢
  • 2020-07-09
  • 2021-05-26
  • 2021-07-25
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
相关资源
相似解决方案