Skip to content
Advertisement

Get total count of duplicates in column

I need a query to count the total number of duplicates in a table, is there any way to do this?

If I have a table like this:

I can’t use SELECT COUNT(quantity) because it returns 2. (40 | 29)

How can I return 5? (40 | 40 | 29 | 29 | 29)

Advertisement

Answer

Using analytic functions:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement