两个表分别都有两个相同的字段比如A表有cityId,cityName.B表也有cityId,cityName. B表的cityId和cityName都有值。A表有大量数据cityId有值且值都包含在A表。cityName为空。如何去根据B表填充A表的cityName?
小伙看你根骨奇佳,潜力无限,来学PHP伐。
update A join B set A.cityName=B.cityName on A.cityId=B.cityId
sqlUPDATE a, b SET a.cityName = b.cityName WHERE a.cityId= b.cityId
sql
UPDATE a, b SET a.cityName = b.cityName WHERE a.cityId= b.cityId
update A join B set A.cityName=B.cityName on A.cityId=B.cityId