SELECT EWRporta_categories.*, COUNT(EWRporta_catlinks.catlink_id) AS count
FROM EWRporta_categories
INNER JOIN EWRporta_catlinks ON (EWRporta_catlinks.category_id = EWRporta_categories.category_id)
GROUP BY EWRporta_categories.category_id
ORDER BY category_name ASC