I have a table that I need to find duplicate entries for based on 3 values. If 2 or more rows contain the same values for col_A, col_B, and col_C then they are duplicates.
I was able to do this when the duplicates were determined by a single column using:
SELECT col_A, COUNT(col_A) AS Expr1
FROM Table_1
GROUP BY col_A
HAVING (COUNT(col_A) > 1)
ORDER BY Expr1 DESC
This told me how many duplicates I had of column A. I then used:
SELECT distinct col_A
INTO Table_1_temp
FROM Table_1
This gave me a table free of duplicates.
But I'm lost on how to do this now that there are 3 variables in the mix.
I'm thinking that to get a table free of duplicates based on 3 variables I would use:
SELECT distinct col_A, col_B, col_C
INTO Table_1_temp
FROM Table_1
But again I'm shooting in the dark here as I have very little SQL experience.
I was able to do this when the duplicates were determined by a single column using:
SELECT col_A, COUNT(col_A) AS Expr1
FROM Table_1
GROUP BY col_A
HAVING (COUNT(col_A) > 1)
ORDER BY Expr1 DESC
This told me how many duplicates I had of column A. I then used:
SELECT distinct col_A
INTO Table_1_temp
FROM Table_1
This gave me a table free of duplicates.
But I'm lost on how to do this now that there are 3 variables in the mix.
I'm thinking that to get a table free of duplicates based on 3 variables I would use:
SELECT distinct col_A, col_B, col_C
INTO Table_1_temp
FROM Table_1
But again I'm shooting in the dark here as I have very little SQL experience.
