zrmw

有两张表,info1, info2 。

info1:

 

 info2:

 

 现在,要用info2中的数据更新info1中对应的学生信息,sql语句如下:

UPDATE info1 t1 JOIN info2 t2 
ON t1.name = t2.name
SET t1.age = t2.age, t1.class = t2.class;

运行结果如下:

 

 更新过的info1:

 

 至于效率问题,之前我有三张表,都在40万左右。需要将 table2 中的两个字段(step1),table3 中的一个字段(step2),更新到 table1 中。step1 用时半个小时左右,而 step2 用了两个多小时,不知为何。三个表都根据一个相同字段建立了唯一索引。

本人装了 navicat 破解版,垃圾,有时候越着急,就越是卡。

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
  • 2021-11-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-12-13
  • 2022-12-23
相关资源
相似解决方案