MySQL中 You can’t specify target table for update in FROM clause 错误解决方法
UPDATE t_comment SET pid=0
#SELECT*FROM t_comment
#同时选择并且更新,MySQL需要中间表进行过滤
WHERE id IN(
SELECT a.id FROM
(
SELECT cb.id FROM t_comment AS cb GROUPBY article_id HAVINGCOUNT(*)=1
) AS a
)