Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个带有代码的表城市,另一个是员工表。插入时的问题是插入实际名称而不是城市的代码。我需要用代码替换它们。我有 2400 名员工。什么样的的 sql-query 我应该写用城市的实际代码替换 Employe 表中的所有城市名称
UPDATE e SET City = c.Code FROM Employe AS e INNER JOIN City AS c ON c.City = e.City
UPDATE employees a, City b SET a.code = b.code WHERE b.name = a.code;