I need to update (UPDATE) the result of a select in mysql for node js and myadminphp does not accept the instruction

0

I am working a socket.io to update a database. The data read and served by socket.io to a file pug I want to mark with estado=1 .

Initially the value is 0.

I want the% co_of% to read 10 articles and be in consultation to update those records, but I have made a variety of options and neither SELECT or myadminphp admit the node js of update .

UPDATE consulta 
SET consulta.estado=1 
FROM 
  (SELECT * AS consulta 
  FROM articulos 
  WHERE articulos.estado<>1 LIMIT 1, 10 
  AS consulta);
    
asked by marqueTTronica 06.04.2017 в 03:32
source

2 answers

1

I'm not sure if that query should work, most likely not. You should see if the id of the records where the update runs is in the records that the sub query returns.

I imagine a query like this:

UPDATE consulta
  SET estado = 1
  WHERE id IN (
    SELECT id FROM (
      SELECT id FROM consulta
        WHERE estado <> 1
        LIMIT 1, 10
    ) tmp
  )
    
answered by 07.04.2017 / 15:31
source
0

It may be that the user who is managing the database can not update, so you must give GRANT permissions in the database so that it can update, verify the permissions of the user you are using and there you will see where you can do.

    
answered by 06.04.2017 в 05:46