Untitled
unknown
plain_text
10 months ago
592 B
5
Indexable
WITH x AS (
SELECT video_id, SUM(youtube_views) AS total_views
FROM youtube_views
GROUP BY video_id
),
y AS (
SELECT video_id, SUM(age_group_13_34_views) AS views_13_34
FROM youtube_views
GROUP BY video_id
)
SELECT x.video_id
,vi.video_title
,x.total_views
,y.views_13_34
,y.views_13_34 / x.total_views AS pct_views
FROM x
INNER JOIN y USING (video_id)
INNER JOIN (select distinct video_title, video_id from video_info) as vi using (video_id)
WHERE y.views_13_34 / x.total_views > 0.5; -- Using full calculation instead of aliasEditor is loading...
Leave a Comment