Counting records belonging to a category in MySQL
问题 I've been battling with some SQL and can't seem to get my head around it. I have two tables, one with the list of categories and another with all my articles. What i'm trying to do is find how many articles are present for each category. Here is the SQL I have so far SELECT DISTINCT COUNT( po.post_Cat_ID ) AS Occurances, ca.cat_Title FROM Posts po, Categories ca WHERE ca.cat_ID = LEFT( po.post_Cat_ID, 2 ) The reason I use LEFT is to only get the main categories as I have listed categories as