国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

mysql update inner join錯誤

瀏覽:120日期:2022-06-17 15:48:12

問題描述

問題解答

回答1:

create table tb1( country int, province int, city int);create table tb2( country int, province int, city int);insert into tb1 (country, province, city) values (1, 2, 5), (1, 3, null);insert into tb2 (country, province, city) values (1, 2, 5), (1, 3, 7);select * from tb1;select * from tb2;update tb1inner join tb2 on tb1.country=tb2.country and tb1.province=tb2.provinceset tb1.city=tb2.citywhere tb1.city is null; -- and tb1.xx=?select * from tb1;select * from tb2;

update from 語句在 mssql 中有效, mysql 似乎無法正常執行

update tb1 set city=r.city from (select country, province, city from tb2) as rwhere tb1.city is null and tb1.country=r.country and tb1.province=r.province

http://sqlfiddle.com/#!9/4df7d7/2

相關文章:
主站蜘蛛池模板: 榆中县| 西平县| 桂平市| 曲周县| 临泉县| 西乌珠穆沁旗| 张掖市| 凌源市| 涪陵区| 福安市| 鄂州市| 莒南县| 平江县| 泽州县| 贵南县| 同江市| 丰顺县| 吉木乃县| 东阿县| 禄劝| 基隆市| 河南省| 岑溪市| 黄石市| 红安县| 翁牛特旗| 崇信县| 蓬安县| 舟山市| 杭锦后旗| 迭部县| 荔波县| 新竹市| 娄烦县| 克什克腾旗| 延长县| 方正县| 出国| 厦门市| 临汾市| 玛沁县|