我想从我的表中删除只出现一次的行。 我试过这个,但它给了我错误。
delete from trans where nol in (select nol from trans T1 group by T1.nol having count(*) = 1)
答案 0 :(得分:2)
在MySQL中,您无法修改在SELECT部分中使用的同一个表。 要解决此问题,您需要将子查询包装到表别名中。
示例查询:
delete from trans
where nol in (SELECT nol FROM
(select nol from trans T1 group by T1.nol having count(*) = 1) t)