SELECT ID, Title, COUNT(Type) AS NumberofType
GROUP BY Type
"Type" is your table's category or type field and NumberofType is simply the name you give the count so that you can then display it on your page. You can call this anything you like. You need to use GROUP BY to group the types.
I'll assume this is a recordset you're creating, in which case you'd then display the count on the page as:
<?php echo($RECORDSETNAME->getColumnVal("NumberofType")); ?>