Skip to content

Instantly share code, notes, and snippets.

@chribsen
Last active March 21, 2016 12:13
Show Gist options
  • Save chribsen/7a85132e2db168fa087f to your computer and use it in GitHub Desktop.
Save chribsen/7a85132e2db168fa087f to your computer and use it in GitHub Desktop.
-- This SELECT statement counts how many days a pair of users have had at least 1 co-occurence and then bins them by day.
-- Used for visualization.
select s, sum(t.cou) from generate_series(0,10) as s left join
(select user_a, user_b, count(*) as cou from derived_friend_list_days where nr_of_occurences > 0 group by user_a, user_b) as t
on t.cou = s
group by s;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment