gpt4 book ai didi

mysql - 从数据库中选择行,然后更改列中的值

转载 作者:行者123 更新时间:2023-11-29 12:15:29 25 4
gpt4 key购买 nike

我正在使用以下查询:

select id,link,size from files where status='-1' ORDER BY id DESC LIMIT 10

然后我想将所选行的“状态”列值更改为-2,是否可以在同一查询中组合“选择”和“更新”功能,这样我就不必查询再次数据库?

最佳答案

您不需要将选择与更新结合起来:尝试:

update files set status='-2' where status='-1' order by id desc limit 10;

字段名称与此处无关。

关于mysql - 从数据库中选择行,然后更改列中的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29876579/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com