Basically what I have is a ratings system. 1-5 stars for 4 categories. What I'm trying to do is get a count of the results for each category. For instance:
Category 1: 20 1 star, 32 2 star, 40 3 star, 35 4 star, 19 5 star
...
Category 4: 10 1 star, 12 2 star, 45 3 star, 54 4 star, 2 5 star
I know that I can just do 20 queries, (SELECT COUNT(*) WHERE BizID=$id AND category1=1 / SELECT COUNT(*) WHERE BizID=$id AND category1=2...), but I was wondering if there was a more efficient way. Seems like if I had a large number of hits, or there were a huge number of ratings, the script would bog down pretty bad at this point. Any help would be appreciated.
Table Structure
RateID - int(10)
UserID - varchar(8)
BizID - varchar(8)
Cat1 - int(1)
Cat2 - int(1)
Cat3 - int(1)
Cat4 - int(1)
Date - int(10)
INfor this.