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;


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM