SQL Query not working

Hi! I´m trying to make a query in order to update certain rows of a column in one Record (CPF_Lineas_Pedido) with the exact values of the columns of Record 2 (CPF_Lineas_Recepcion), where the variables "IdPedido" and "Material" are the ones used in the process

Query:

"

UPDATE CPF_LINEAS_PEDIDO, CPF_LINEAS_RECEPCIONES_V3

SET CPF_LINEAS_PEDIDO.CANT_RECEP_ACUM =  CPF_LINEAS_RECEPCIONES_V3.CANTIDAD_RECEP

WHERE CPF_LINEAS_PEDIDO.ID_PEDIDO = ac!pedido AND  CPF_LINEAS_PEDIDO.MATERIAL IN

(SELECT material FROM CPF_LINEAS_RECEPCIONES_V3 WHERE ID_PEDIDO = ac!pedido)

"

The query changes the values of the desired rows of CPF_Lineas_Pedido,  but instead of picking the same value of the other table, it takes random values

1) I introduce the value of "Cantidad Recepcionada" for each Line, and the record is written

2) Database CPF_Lineas_Recepcion written (ok)

3) Database CPF_Lineas_Pedido written (not ok)

How would you link this fields by query? Would you try a different approach?

  Discussion posts and replies are publicly visible