#1093 - 您不能在 FROM 子句中为更新指定目标 table 'new_keyword'
#1093 - You can't specify target table 'new_keyword' for update in FROM clause
我有这样的查询
update new_keyword set key_count=key_count-1 where id in
(select b.id from new_keyword b ,new_news a ,new_mudoal_label c where c.label_id=b.id and a.id=c.id and c.type=1 and c.id=186)
子查询return id 例如(1,2,3)
但是 mysql 告诉我错误
我用这段代码解决了我的问题
update new_keyword set key_count=key_count-1 where id in
(select c.label_id from new_news a ,new_mudoal_label c where a.id=c.id and c.type=1 and c.id=186)
我有这样的查询
update new_keyword set key_count=key_count-1 where id in
(select b.id from new_keyword b ,new_news a ,new_mudoal_label c where c.label_id=b.id and a.id=c.id and c.type=1 and c.id=186)
子查询return id 例如(1,2,3) 但是 mysql 告诉我错误
我用这段代码解决了我的问题
update new_keyword set key_count=key_count-1 where id in
(select c.label_id from new_news a ,new_mudoal_label c where a.id=c.id and c.type=1 and c.id=186)