最近遇到一个比较蛋疼的问题,有city_2、city_3两张表,需要将city_3中的部分数据复制到city_2中的某一字端上,如是在MYSQL下写了如下sql语句
update city_2 set city_2.city = city_3.city from city_2, city_3 where city_2.childCode = city_3.childCode
执行是没有问题的,然而当我在sqlite中去执行该语句的时候发现该语句报错,原来是sqlite不支持该语法,如是修改
update city_2 set
city=(select city from city_3 where city_2.childCode = city_3.childCode)
where
childCode = (select childCode from city_3 where city_3.childCode = city_2.childCode)
然后执行的时候发现没有问题。