I have two grouped entries but only one is changed in the update

Asked

Viewed 32 times

0

I set up an update by grouping the field presenca which should change two arrays in a repeat loop, follows the query:

UPDATE acessos AS a
  JOIN
    ( SELECT usr_id, presenca
      FROM acessos
      GROUP BY presenca
    ) AS c
    ON  a.usr_id = c.usr_id

SET 
    a.presenca = 1
    WHERE a.usr_id = 2

It only works with the usr_id = 10, what can be?

  • I arrived at safe_update, with error 1175 that Workbench printed me.

1 answer

0

I resolved with:

@mysql_query("SET SQL_SAFE_UPDATES=0;", $conn1);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.