因爲執行此更新對where子句不起作用?更新爲我所有。使用內部連接更新Postgresql
UPDATE ventas SET eav_id = 7
FROM ventas AS A
inner join ventasDetalle AS e on A.act_id = e.act_id and e.exp_id = A.exp_id
where a.eav_id = 1
因爲執行此更新對where子句不起作用?更新爲我所有。使用內部連接更新Postgresql
UPDATE ventas SET eav_id = 7
FROM ventas AS A
inner join ventasDetalle AS e on A.act_id = e.act_id and e.exp_id = A.exp_id
where a.eav_id = 1
update ventas a
set eav_id = 7
from ventasDetalle e
where a.eav_id = 1 and (a.act_id, a.exp_id) = (e.act_id, e.exp_id)
PostgreSQL的UPDATE語法是:
[ WITH [ RECURSIVE ] with_query [, ...] ]
UPDATE [ ONLY ] table [ [ AS ] alias ]
SET { column = { expression | DEFAULT } |
(column [, ...]) = ({ expression | DEFAULT } [, ...]) } [, ...]
[ FROM from_list ]
[ WHERE condition | WHERE CURRENT OF cursor_name ]
[ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]
所以我想你想:
UPDATE ventas AS A
SET eav_id = 7
FROM ventasDetalle AS e
WHERE (A.act_id = e.act_id and e.exp_id = A.exp_id)
錯誤去sintaxis ENØCERCA德«內» – Max
坦克! !不同,因爲我想,但它的作品。 – Max