且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在mysql中基于另一个表更新表?

更新时间:2023-12-01 10:01:04

您是否要批量更新所有现有行?

Are you trying to update all of the existing rows in bulk?

如果是这样,这是进行更新的一种方法:

If so, here's one way to do the update:

update users u
  inner join zips z on z.zip = u.zip
set u.state = z.state,
  u.city = z.city;