I have a table with the following columns:
ID
refip
refname
refdate
All I want to do is to display a summary of the 'refname' entries with the total number of entries for each.
Like:
nameA = 3
nameB = 7
nameC = 2
Here is my SQL query:
$result = mysql_query("SELECT refname, COUNT(refname) AS subtotal FROM cc_refsource GROUP BY refname",$db) or die(mysql_error());
I get only 3 names showing which is great, but no totals for each.
A further snippet:
while ($row = mysql_fetch_array($result)) {
echo "$row['refname']";
echo "$row['subtotal'];
}
Any help is appreciated. Thanks.