mysql两张表联查更新语句_mysql update语句添加表关联查询

UPDATE tab_game_version  as a INNER JOIN tab_game_version as b ON a.id=b.id

SET a.advert_data=0 where a.advert_data is NULL

UPDATE table1 AS a LEFT JOIN (SELECT CONCAT(p.f_area_name,s.f_area_name,t.f_area_name) addressPrefix,t.f_area_id FROM table2 t LEFT JOIN table3 s ON t.f_city_code=s.f_area_id LEFT JOIN table4 p ON s.f_province_code=p.f_area_id) AS b ON a.f_address_area=b.f_area_id SET a.f_address_prefix=b.addressPrefix;

UPDATE table1 AS a LEFT JOIN (SELECT CONCAT(p.f_area_name,s.f_area_name,t.f_area_name) addressPrefix,t.f_area_id FROM table2 t LEFT JOIN table3 s ON t.f_city_code=s.f_area_id LEFT JOIN table4 p ON s.f_province_code=p.f_area_id) AS b ON a.f_store_area=b.f_area_id SET a.f_address_prefix=b.addressPrefix;


版权声明:本文为weixin_39620684原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。