久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

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

mysql update inner join錯誤

瀏覽:143日期: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

相關文章:
主站蜘蛛池模板: 漯河市| 嵩明县| 通辽市| 留坝县| 通河县| 双牌县| 广汉市| 泾源县| 孙吴县| 金沙县| 泾阳县| 青浦区| 隆德县| 安顺市| 丰顺县| 甘南县| 贺州市| 罗田县| 循化| 甘洛县| 拜泉县| 和田市| 佛山市| 碌曲县| 股票| 监利县| 利津县| 丹棱县| 林芝县| 汝城县| 桦川县| 疏附县| 昭通市| 大港区| 体育| 应城市| 独山县| 西丰县| 吉林市| 沿河| 宜宾县|