Hi I have a table like this
ID UserName 1 test@test.com 2 test@test.com 3 john@stack.com 4 test@test.com 5 adam@stack.com 6 john@stack.com
I need an output like this. I need only repeated rows list. How can I create this kind of an output using mysql query.
ID UserName Count 1 test@test.com 3 2 john@stack.com 2
Please help me.
Thanks.
since the ID is not unique so its a bit not logical to get the sum of unique UserName from the table.
If the ID is not required we can get the result from single query.
But in the case of ID in the result it will be a more complicated query including sub-query and inner table.