2017-05-22 2 views
1

Parce que cette mise à jour ne fonctionne pas pour la clause where? La mise à jour le fait pour moi tous.Mise à jour avec jointure interne 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 

Répondre

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) 
+0

Tanks !!! ! Différent comme je le voulais mais ça marche. – Max

0

La syntaxe UPDATE Postgresql est:

[ 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 ] [, ...] ] 

Je pense que vous voulez:

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) 
+0

erreur de sintaxis en o cerca de «intérieur» – Max