I have tables pages (id, ...) and page_visits (id, page_id, is_subscribed)
The page_visits table now has about 2 million rows per one page_id.
I need to create a query that will grab count of visits and subscriptions per one page. My query only grabs visits count now:
SELECT page_id, COUNT(page_id) AS visits
FROM `page_visits`
WHERE `page_id` in (1, 2)
GROUP BY `page_id`
But how to add here an page_subscriptions column in result that will contains count of rows where is_subscriped = 1 per one page_id?