Hey men I've got a mysql table known as interests with 4 posts. interestID, title, categoryID interest_desc and date. the categoryID column is related to some seperate table. Wouldso would I personally use a mysql query that checked the number of interests have been in a particular category?

Im speculating i personally use some kind of count() query?

Thanks men

Update -

$count_query_v1 = "SELECT categoryID, COUNT(*) AS total FROM interests GROUP by categoryID; ";     $answer = mysql_query($count_query_v1) or die(mysql_error()); echo $answer;

Getting closer but nonetheless not perfect, i wish to echo the categoryID most abundant in interestID's

select category_name, count(*) as total
from interests i left join category c on c.category_id = i.category_id
group by i.category_id;

count + group by,
presuming interestID may be the unique primary key,
and every interest rates are associated with single category (as that which you have proven)

select categoryID, count(*) as total
from interests
group by categoryID;

// the above example is a simple group by ID without using inner join

output :-

categoryID, total

Choose COUNT(interestID) FROM interests WHERE categoryID = 'yourvalue'

Choose COUNT(interestID), categoryID FROM interests GROUP BY categoryID

Would it not you need to be something similar to:

//grab all of the categoryIDs and insert them in a flexible // You need to have the ability to grab these having a simple choose

Then loop through these, and make a move like: Choose COUNT(interestID) FROM table_title WHERE categoryID = currentCategoryID

As you are while using place query each query will place one record, so just count the amount of place queries you take using a counter varialble.