View Single Post
Old 03-26-2006, 10:15 AM   #3 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
or something like this:
PHP Code:
<?
$result 
mysql_query("select c.category_name, count(a.article_id) as count from np_categories as c
  left join np_articles as a on c.category_id=a.article_category_id
  group by c.category_id
  order by c.category_name"
);

while (
$row mysql_fetch_assoc($result)) {
  echo 
$row['category_name'] . " (" $row['count'] . ")<br />\n";
}
sde is offline   Reply With Quote