Skip to content

Instantly share code, notes, and snippets.

@takada-at
Created September 3, 2020 04:34
Show Gist options
  • Save takada-at/3207ba595d57a3fe47b23ed46ea2f3bb to your computer and use it in GitHub Desktop.
Save takada-at/3207ba595d57a3fe47b23ed46ea2f3bb to your computer and use it in GitHub Desktop.
WITH pdata AS (
SELECT _PARTITIONDATE AS date, player_id, platform
FROM penguin_jp.person_data
WHERE
_PARTITIONDATE BETWEEN '2020-06-01' AND '2020-06-11'
)
SELECT _PARTITIONDATE AS date, pdata.platform, SUM(price)
FROM penguin_jp.virtual_coin AS v
JOIN pdata ON pdata.player_id=v.player_id AND pdata.date = v._PARTITIONDATE
WHERE
_PARTITIONDATE BETWEEN '2020-06-01' AND '2020-06-10'
GROUP BY 1, 2 ORDER BY 1, 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment