We have a basic query, which get us; cat_id, parent_id, cat_name and the total entry_count which is then displayed in the form of a report... the current query is:
SELECT c.cat_id, c.parent_id, c.cat_name, count(t.entry_id) AS entry_count
FROM exp_categories c
JOIN exp_category_posts p ON p.cat_id=c.cat_id
LEFT JOIN exp_channel_titles t ON p.entry_id=t.entry_id AND t.channel_id IN (2,6,7,8,9,10)
WHERE c.group_id=1
GROUP BY c.cat_id
This works, however we also want to get the TOTAL view_count_one for all entries in a given category...
Any ideas how this would be expanded to achieve this?