mysql + update top n
UPDATE table
SET status = 1
WHERE status = 2
ORDER BY id
LIMIT 400
Checked in MySQL 5.2.0-falcon-alpha-community-nt-log
, confirmed working.
In your case it's 0
in LIMIT 0, 400
that does not work.
You cannot use the lower bound in UPDATE
's LIMIT
.
Try this:
update table
set status = 1
where status = 2
LIMIT 400
You can also put an order by clause
update table
set status = 1
where status = 2
ORDER BY id
LIMIT 400