mysql update inner join错误
问题描述
问题解答
回答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
相关文章:
1. dockerfile - 我用docker build的时候出现下边问题 麻烦帮我看一下2. docker api 开发的端口怎么获取?3. boot2docker无法启动4. docker不显示端口映射呢?5. docker-compose中volumes的问题6. debian - docker依赖的aufs-tools源码哪里可以找到啊?7. mysql - phpmyadmin怎么分段导出数据啊?8. docker images显示的镜像过多,狗眼被亮瞎了,怎么办?9. macos - mac下docker如何设置代理10. docker start -a dockername 老是卡住,什么情况?

网公网安备