I'm using PDO (still learning) and have the current SQL query. This works perfectly, merging duplicate entries and adding their value. Is there a way I could see how many duplicate entries there were?
$SQL = "SELECT Col1, SUM(Col2) FROM table WHERE Date > :FromDate AND Date < :EndDate GROUP BY Col1";
My table looks like this
Col1 Col2
----- ------
ABC 2
ABA 3
ADD 1
AED 3
ABC 2
ABA 3
ADD 1
AED 3
AED 0
At the moment, after I loop through, the result looks like this
Col1 Col2
---- ----
ABC 4
ABA 6
ADD 2
AED 6
But i'd like to get the value of how many times it occured in the DB before it was grouped so i could end up with
Col1 Col2 Times Appeared
---- ---- --------------
ABC 4 2
ABA 6 2
ADD 2 2
AED 6 3