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

0

I've mounted an update by grouping the presenca field that should change from two arrays to one repeat loop, follow 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 usr_id = 10 , what can it be?

    
asked by anonymous 09.01.2018 / 01:29

1 answer

0

I resolved with:

@mysql_query("SET SQL_SAFE_UPDATES=0;", $conn1);
    
09.01.2018 / 02:51