you need to use a join query to join the category table to the listing table and use the count() function to count the listings.
Lets use the items and itemcatagory tables from the blue sky music database as an example:
http://www.webassist.com/webassist/actions/do_download.php?file=25/94/blue_sky_music.zip&from=/community/tutorials/view_tutorial.php
using the following query:
SELECT itemcategory.*, count(items.itemID) as itemCount
FROM items
INNER JOIN itemcategory ON itemcategory.ItemCatID = items.ItemCatID
GROUP BY itemcategory.ItemCatID
would give the following results:
+-----------+-------------+-----------+
| ItemCatID | ItemCatName | itemCount |
+-----------+-------------+-----------+
| 1 | CD | 6 |
+-----------+-------------+-----------+
| 2 | Gear | 5 |
+-----------+-------------+-----------+
so the itemCount column has the number of items for each category