首页 > 代码库 > 删除重复数据,保留一条

删除重复数据,保留一条

--P_CODE 重复列DELETE FROM TabWHERE P_CODE IN(SELECT P_CODE FROM Tab GROUP BY P_CODE HAVING COUNT(P_CODE) > 1)AND ROWID NOT IN(SELECT MIN(ROWID) FROM Tab GROUP BY P_CODE HAVING COUNT(*) > 1);

 

删除重复数据,保留一条