You're correct, there should be at least twice the number of rows returned. Your code is overly complex, you don't need the DISTINCT and the Derived Table A, but this will not change the result:
SELECT A.*
FROM TABLE A
INNER JOIN
(
SELECT COL1,COL2,COL3
FROM TABLE
GROUP BY COL1,COL2,COL3
HAVING COUNT(*)>1
) B
ON
A.COL1=B.COL1 AND
A.COL2=B.COL2 AND
A.COL3=B.COL3
There must be something else, could you post your actual query?
Depending on the number of columns in your table and the number of duplicates there is another approach:
SELECT *
FROM TABLE
QULAIFY
COUNT(*) OVER (PARTITION BY COL1,COL2,COL3) > 1
Dieter
You're correct, there should be at least twice the number of rows returned. Your code is overly complex, you don't need the DISTINCT and the Derived Table A, but this will not change the result:
There must be something else, could you post your actual query?
Depending on the number of columns in your table and the number of duplicates there is another approach:
Dieter