You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT business_id, occurences, AVG(occurences) OVER(PARTITION BY event_type ORDER BY occurences RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) as avg_occur
FROM Events),
second AS (
SELECT business_id, SUM(CASE WHEN occurences > avg_occur THEN 1 ELSE 0 END) as balance