here is my table Table1
:
examplecolumn1 | examplecolumn2
--------------------------------
AAA | 555
BBB | 555
AAA | 333
AAA | 444
CCC | 111
I'm trying to make a query that returns
AAA 3, 555 2
the most frequent value in column1 and the frequency, and the same for the column 2.
can I do it with a single query in PHP? or should I do more than one query?
I have to do it for 4 columns, so if I do it in just one query is better, but I have no idea
I tried:
SELECT COUNT(`examplecolumn1`) AS FREQ FROM `Table1` GROUP BY `examplecolumn1`
thanks in advance