SQL筛选重复数据的方法有多种,下面列举了几种常用的方法:
SELECT column1, column2, COUNT(*) as count
FROM table
GROUP BY column1, column2
HAVING COUNT(*) > 1;
SELECT column1, column2
FROM table
WHERE column2 IN (
SELECT column2
FROM table
GROUP BY column2
HAVING COUNT(*) > 1
);
WITH cte AS (
SELECT column1, column2, ROW_NUMBER() OVER(PARTITION BY column1, column2 ORDER BY column1) AS rn
FROM table
)
SELECT column1, column2
FROM cte
WHERE rn > 1;
以上是几种常用的方法,根据具体情况选择合适的方法进行筛选。