我想這么寫(xiě),不過(guò)mysql版本不支持。
update ring_category_details set hotOrNew = 0
where ctId not in
(select ctId from ring_category_details where ctId = 4 order by updatetime desc, weight desc limit 10)
and hotOrNew = 1;
[Err] 1235 - This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
假如可以這么寫(xiě),感覺(jué)性能是問(wèn)題。
作者: cxytz01 時(shí)間: 2014-04-08 20:12
update ring_category_details set hotOrNew = 0 where id not in (select id from (select id from ring_category_details where ctId = 4 order by updatetime desc, weight desc limit 10) t ) and hotOrNew = 1;作者: action08 時(shí)間: 2014-04-09 15:51
用存儲(chǔ)過(guò)程來(lái)做吧