Last active
September 18, 2022 18:17
-
-
Save thistleknot/5678d338f57d9bbd2a6c3a6e91384857 to your computer and use it in GitHub Desktop.
Find max quarterly return
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
SELECT p."Date" | |
,p."Symbol" | |
,p."ratio_roll_qtr_ret" | |
FROM PUBLIC."prices_vw" AS p | |
JOIN ( | |
SELECT "Symbol" | |
,max("Date") | |
FROM PUBLIC."prices_vw" | |
GROUP BY "Symbol" | |
) AS sq ON p."Date" = sq."max" | |
AND p."Symbol" = sq."Symbol" | |
WHERE p."ratio_roll_qtr_ret" IS NOT NULL | |
ORDER BY "ratio_roll_qtr_ret" DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment