SELECT `news_categories`.*, Count(news_article_categories.news_article_id) as article_count, MAX(news_articles.date) as recent_date SELECT `venues`.*, (select COUNT(*) from tour_stops where tour_stops.venue_id=venues.id AND tour_stops.end_date > curdate() AND tour_stops.active = 1) tour_stop_count LEFT JOIN `pages` as `parents` ON `parents`.`id` = `pages`.`parent_page_id`ĪND `white_label_inclusions`.`entity_type` = 'page' SELECT `pages`.*, `parents`.`url_name` as `parent_url_name`
WHERE `white_label_versions`.`url` = ''ĪND `white_label_inclusions`.`entity_type` = 'tour'
JOIN `white_label_versions` ON `white_label_versions`.`id` = `white_label_inclusions`.`white_label_version_id` SELECT `white_label_inclusions`.`entity_id`
WHERE `views` curdate() AND tour_stops.active = 1) tour_stop_count