samedi 5 avril 2014

MySQL UPDATE updating only the first row; SELECT with the same criteria returns many rows;


Vote count:

0




So, i have this query:


UPDATE ranking_position SET position=ranking_position.position-1 WHERE (ranking_position.position > 3) AND tournament_team_id IN (SELECT id FROM tournament_team team WHERE team.category_id=38)


Which is supposed to "move up" the position of everyone team after the 3rd position that belongs to the category 38;


What is happening is that each time i run this query it updates only 1 row; If I do the SELECT query with exactly the same criteria:


SELECT * FROM ranking_position WHERE position > 3 AND tournament_team_id IN (SELECT id FROM tournament_team team WHERE team.category_id=38)


I get the expected results (many rows).


What am I doing wrong?


Thanks!



asked 22 secs ago






Aucun commentaire:

Enregistrer un commentaire