问题:a表中有单位,b表中也有单位,现在要替换a表中的所有单位编号,需要查询B表(相当于单位表)
mysql 和SqlServer都可以使用


UPDATE sys_teleuser a
set deptcode=(select DISTINCT dept_id from sys_dept b where b.dept_name=a.DeptName )

相关文章:

  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-12-26
  • 2022-12-23
  • 2022-02-02
  • 2022-02-20
猜你喜欢
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
相关资源
相似解决方案