gpt4 book ai didi

mysql更新(in)多于1行

转载 作者:行者123 更新时间:2023-11-29 06:35:44 26 4
gpt4 key购买 nike

UPDATE tbl_bonuses AS B 
INNER JOIN tbl_member AS V
ON B.recepient_code = V.user_id
SET B.points = B.points + 15, B.ctr = B.ctr + 15
WHERE user_id IN (SELECT user_id from tbl_member LIMIT 10);

错误:

#1235 - This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

有没有其他方法可以在不使用 (in) 的情况下使用多个参数进行多次更新?

最佳答案

将子查询包装在派生表中

UPDATE tbl_bonuses AS B 
INNER JOIN tbl_member AS V
ON B.recepient_code = V.user_id
SET B.points = B.points + 15, B.ctr = B.ctr + 15
WHERE user_id IN (SELECT user_id FROM (
SELECT user_id from tbl_member LIMIT 10
) t
);

关于mysql更新(in)多于1行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24952503/

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