Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
291 B
2
Indexable
Never
SELECT 
    s.username,
    COUNT(cs.id) AS total_streams,
    AVG(cs.viewers) AS avg_viewers
FROM 
    streamers s
JOIN 
    completed_streams cs ON s.id = cs.streamer_id
GROUP BY 
    s.id
HAVING 
    COUNT(cs.id) > 5 AND AVG(cs.viewers) > 5000
ORDER BY 
    avg_viewers DESC;
Leave a Comment