Last active
June 12, 2022 14:13
-
-
Save peacing/04ded116f1a5a0d24b300270dc453811 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with yest AS ( | |
SELECT currency, price | |
FROM f_crypto_prices | |
WHERE datekey = '20220315') | |
, today AS ( | |
SELECT currency, price | |
FROM f_crypto_prices | |
WHERE datekey = '20220316') | |
SELECT | |
currency, | |
(today.price - yest.price) / yest.price * 100 AS pct_change | |
FROM yest, today | |
WHERE currency = 'BTC' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment