MYSQL - UPDATE to two tables

0

hi friends (as) along with greeting them came to ask for your guidance (again), I have 2 tables that have a field in common: id_estado. What I have to do is update this field in both tables simultaneously, since this id then shows the field in a grid. My problem comes with the sentence itself, and with the conditions for the update to be made, the tables are like this:

/*Tabla Acciones*/  
  id_accion (ai)(pk)
  id_incidencia (int)
  id_estado(int)
  detalle(varchar)
  
  
  /*Tabla incidencias*/  
  id_incidencia(ai)(pk)
  id_estado(int)
  id_funcionario (int)
  detalle(varchar)

As you can see, an incident can be inserted multiple actions, so I need to do: .- update to the field id_estado of the table incidents, according to the id_incidence, but that also leaked to which id_accion belongs, will it be possible? I used this query as a test, it did not give me an error, and I modify it in principle, but now it does not work anymore:

UPDATE tbl_acciones_incidencia, tbl_incidencias 

SET id_estado = '9', id_estado = '9' FROM tbl_acciones_incidencia ac, tbl_incidencias inc ON ac.id_estado = inc.id_estado WHERE id_incidence = '3'

I thank everyone from now on for their comments and help

    
asked by Nicolas Ezequiel Almonacid 30.04.2018 в 00:01
source

0 answers