在SQLite中如何用一个表的字段更新另一个表

SQL语句:
update table_1 set x = (select x from table_2 where table_1.y =  table_2.y);
如果括号中临时建立的表中元素的个数小于table_1中元素个数或者只想更新table_1中部分x的值,可以在后面加where子句.

Example:
更新产品库存:
update product set stock=(select stock from left where left.product_id=product.product_id) where product_id in (select product_id from left)
原文地址:https://www.cnblogs.com/bukekangli/p/4636059.html