Skip to content

Instantly share code, notes, and snippets.

@henhiskan
henhiskan / events.sql
Last active December 10, 2017 04:17
Triple join with windows function
SELECT
city_name,
extract(dow FROM events._ts) as dow,
count(1) as trips,
ROUND(count(1)/ SUM(count(1)) OVER () * 100, 2) as percentage
FROM events LEFT JOIN cities ON events.city_id = cities.city_id
LEFT JOIN trips ON trips.client_id = events.rider_id
WHERE event_name = 'sign_up_success' AND
city_name IN ('Qarth', 'Meereen') AND

Keybase proof

I hereby claim:

  • I am henhiskan on github.
  • I am rrossel (https://keybase.io/rrossel) on keybase.
  • I have a public key whose fingerprint is 7CD8 D7BB 4812 5DF6 E53E 439F DB72 4B6E 352D 56D5

To claim this, I am signing this object: