Is there any statement in mysql that can directly update the first ten items of sorted data?
迷茫
迷茫 2017-05-19 10:07:15
0
2
679

Excuse me, is there any SQL that can directly sort the current table by score, and then update a field in the top ten?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
过去多啦不再A梦

That is, the IN/ALL/ANY/SOME subquery using the LIMIT clause is not supported, as long as you add another layer, such as:

UPDATE table SET name='zhangsan' WHERE id IN
(SELECT t.id FROM (SELECT id FROM table LIMIT 10) AS t) 
phpcn_u1582
update table set name='zhangsan' where id in (
 select id from table order by sorce desc limit 10
)

//可以做到,子查询就完事
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template