Update with Inner join

1

I am trying to update a "group" attribute of my process table, I do the relationship with the subprocess table which has as reference the idProcess of the process table, but it marks me an error when executing the query.

UPDATE P set P.grupo="" FROM proceso P INNER JOIN subproceso SP 
ON P.idProceso=SP.idProceso where P.idUnidadNegocio=3
    
asked by Luis Fernando Zumaran 27.05.2018 в 02:12
source

2 answers

1

I enclose the following answer

UPDATE table_name as P INNER JOIN subproceso as SP ON 
P.idProceso=SP.idProceso set P.grupo="" where P.idUnidadNegocio=3 

Where the important thing was to remove the FROM and also link the alias P with the name of the table that corresponds to it.

    
answered by 27.05.2018 / 02:40
source
0

I would think that the object of the update is to put in "" the group whose business unit is three and that the process number is in the table of subprocesses, if it is correct you can do:
UPDATE set grupo="" FROM proceso WHERE P.idUnidadNegocio=3 AND idProceso IN (SELECT idproceso FROM subproceso)

    
answered by 27.05.2018 в 04:47