4
I have a table where some registrations were made using the same email. I would like to count these repeated emails, for this I am using this way:
SELECT COUNT(DISTINCT email) AS Contar FROM cadastro;
What I find strange, is the quantity returned and why I am unsure to use this query. I would like you to return:
There are 110 repeat emails
And what was the return obtained?
– Woss
So.. he’s returning me many registrations, the amount is: 6050 and the registration has 7543. I’m finding too much email repeated.
– user24136
Yes, what you’re calculating are separate emails, because you used
DISTINCT
. The difference from this value to the total is repeated emails.– Woss
@Andersoncarloswoss this will only be true if an email does not repeat more than once.
– rLinhares
@rLinhares If I have the records (a, a, a, b, c, c) the result with DISTINCT will be 3, because there are 3 different values, while the total is 7, indicating that there are 4 repeated records (3 a and 1 c)
– Woss
@Andersoncarloswoss you’re right! I confused the balls but I already found myself =p Sorry (I even corrected my answer - I hope I have corrected right)
– rLinhares