如题,本来可以用一条SQL语句完成的为什么非得拆开呢?
本来想这样写的
UPDATE `t1` SET `recommend` = 1 WHERE `id` IN( SELECT `id` FROM `t1` WHERE `userid` = 176 ORDER BY `id` LIMIT 5) |
却提示This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery’
不让这么用,那么再加一层呢?
UPDATE `t1` SET `recommend` = 1 WHERE `id` IN( SELECT * FROM ( SELECT `id` FROM `t1` WHERE `userid` = 176 ORDER BY `id` LIMIT 5) AS t2) |
居然成功了???
受教了!呵呵!