I have a simple query that I execute in mysql
with phpmyadmin
:
select * from tabla for udpate
;
But I get an error "an expression was expected" . I can not realize what is missing. Thanks!
I have a simple query that I execute in mysql
with phpmyadmin
:
select * from tabla for udpate
;
But I get an error "an expression was expected" . I can not realize what is missing. Thanks!
If you use FOR UPDATE with a storage engine that uses page or row locks, the rows examined by the query are locked against writing to the end of the current transaction.
SELECT ... TO UPDATE acquires write locks on the objects (rows, pages, depending on the engine). This implies a bit of overload. In addition, the database (the InnoDB engine in most cases) needs to do additional accounting for the control of multiple versions (MVCC).
See the documentation for MySQL in select ... for update for detailed information and examples
Also I'm noticing that your query has syntax errors:
SELECT * FROM posiciones WHERE Id_torneo = 161 FOR LIMIT 0, 25
It should be:
SELECT * FROM posiciones WHERE Id_torneo = 161 FOR UPDATE
SOLUTION You must remove the LIMIT in the configuration of your engine, that is why you have the problem when executing your query.