<!--% query_hpr_shows = 'WITH
	comment_tallies AS (	
		SELECT 
			eps_id,
			COUNT(eps_id) AS eps_tally
		FROM comments
		GROUP BY eps_id 
	)
	SELECT
		eps.id,
		eps.explicit,
		eps.date, eps.license, eps.duration,
		eps.title, eps.summary, eps.tags,
		eps.notes,
		hosts.local_image,
		hosts.hostid,
		hosts.host, hosts.email, hosts.profile,
		miniseries.name AS series, miniseries.id AS seriesid,
		COALESCE(comment_tallies.eps_tally,0) AS commentsTally
	FROM eps
	INNER JOIN hosts ON eps.hostid = hosts.hostid
	INNER JOIN miniseries ON eps.series = miniseries.id
	LEFT JOIN comment_tallies ON eps.id = comment_tallies.eps_id
	WHERE hosts.hostid = ? AND eps.date < date(\'now\', \'+1 days\')
	ORDER BY eps.id + 0 DESC
	'
%-->
<!--% query_hpr_show_count = '
	SELECT COUNT(id) as Tally
	FROM eps
	WHERE eps.hostid = ? AND eps.date < date(\'now\', \'+1 days\')
	'
%-->
<!--% query_twt_show_count = '
		SELECT COUNT(id) as Tally
		FROM twt_eps AS eps
		WHERE eps.hostid = ?
		'
%-->
<!--% query_twt_shows = '
		SELECT
			eps.id,
			CASE eps.explicit WHEN 1 THEN \'Explicit\' ELSE \'Clean\' END AS explicit ,
			eps.date, eps.license, eps.duration,
			eps.title, eps.summary, eps.tags,
			eps.notes,
			hosts.local_image,
			hosts.hostid,
			hosts.host, hosts.email, hosts.profile,
			miniseries.name AS series, miniseries.id AS seriesid
		FROM twt_eps AS eps
		INNER JOIN hosts ON eps.hostid = hosts.hostid
		INNER JOIN miniseries ON eps.series = miniseries.id
		WHERE hosts.hostid = ?
		ORDER BY eps.id DESC
		'
%-->

