[英]SQL update table1 with condition in table2?
SQL更新table1與table1中的條件?
table1:
id_x
field
table2:
id
id_x
type_id;
update table1 set field=2 where type_id = 4;
我該怎么做(PSQL)?
這應該為你做的伎倆,假設id_x
在表2是外鍵引用id_x
table1中-
update table1 set field=2
where id_x in
(
select id_x from table2 where type_id = 4
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.