在菜鸟的菜鸡(提问者)delete
from
(SELECT * from
(SELECT * from 表
WHERE 表.东西
IN
( SELECT 东西 FROM 表
GROUP BY 东西 HAVING count(东西) > 1)) )as 表1
where 表1.`序号` = (select min(表1.序号) from 表1)请问下那里有问题啊,报错
WITH CTE AS (
SELECT *,
ROW_NUMBER() OVER (PARTITION BY 东西 ORDER BY 序号) AS RowNum
FROM YourTable
WHERE 东西 IN (
SELECT 东西
FROM YourTable
GROUP BY 东西
HAVING COUNT(*) > 1
)
)
SELECT * FROM CTE
WHERE RowNum = 1; -- 预览将要删除的记录