How do you use COUNT outside the WHERE clause in MYSQL
I have a table - something like:
A|B
1|1
1|2
1|3
2|1
2|3
2|4
2|5
3|5
My query returns different values in A if they are the same as the value in B from 1 or 2 - so
A
1
2
I am also trying to get the original counts 1 and 2 back in column A to get something like
A|Count
1|3
2|4
Is there an easy way to get this invoice please? However, COUNT (A) returns the number A that matches the initial WHERE clause:
A|Count
1|2
2|1
Thanks!
+1
Gooseman
a source
to share