Group By and Order By
Posted on 2008-06-16
I am fairly new to SQL and seem to be stuck... I would greatly appreciate any help. I am trying to write an SQL statement that will tell me what text appears most often in my data. For example, if I have
I would like to get 'Ice Cream'
Here's what I have come up with...
"SELECT CC as Complaint, COUNT(CC) AS Total from Data WHERE XYZ GROUP BY CC", which returns
Ice Cream 2
I was thinking if I could at least order the 'Total' column I could just always grab the top result, but I cannot seem to get the 'Order By' function to work with the field. Any idea how to make this work or another way to get the result I am looking for? Thanks!