How i put an update in a SELECT-query at once. I wish to count a field from the SELECTed row.
SELECT * FROM `_server` order by hits asc LIMIT 1 (update `_server` set `hits`=hits+1)
How i put an update in a SELECT-query at once. I wish to count a field from the SELECTed row.
SELECT * FROM `_server` order by hits asc LIMIT 1 (update `_server` set `hits`=hits+1)
You can use order by
and limit
in update
:
update `_server`
set hits = hits + 1
order by hits asc
limit 1;