0514-86177077
9:00-17:00(工作日)
Solution 1: 修改1列
update student s, city c set s.city_name = c.name where s.city_code = c.code;
Solution 2: 修改多個列
update a, b
set a.title=b.title, a.name=b.name where a.id=b.id
Solution 3: 采用子查詢
update student s set city_name = (select name from city where code = s.city_code);
以上這篇mysql用一個表更新另一個表的方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
標簽:重慶 內(nèi)蒙古 臨沂 貴州 常德 天津 湖州 成都
上一篇:mysql 行列動態(tài)轉(zhuǎn)換的實現(xiàn)(列聯(lián)表,交叉表)
下一篇:MySql 5.5.29綠色安裝教程詳解
Copyright ? 1999-2012 誠信 合法 規(guī)范的巨人網(wǎng)絡(luò)通訊始建于2005年
蘇ICP備15040257號-8