Update field of two sql server tables

0

I present the following concern, I need to make an update of the initial amount in the article table, brought from the table articulo18abril as a condition I have established that if they have the same id is assigned the amount that corresponds

when trying to call the articuloid field of the articulo18abril table I get the error that is shown in the following image and I still do not understand it.

Am I doing something wrong?

    
asked by Andrex_11 19.04.2018 в 23:17
source

1 answer

2

related to your concerns what happens is that you are not making a join to bring the information of the other tbl, so please review as I show you below:

  UPDATE a
    SET a.cantidadInicial = art18.cantidadInicial
  FROM articulo AS a
  INNER JOIN articulo18abril art18 
      ON (art18.articuloid= a.articuloid)
  -- WHERE segun sea lo que requieras filtrar en tus condiciones....

I hope it will be useful for you. Greetings.

    
answered by 19.04.2018 / 23:24
source