Created
June 30, 2021 17:15
-
-
Save drio/c10350f3d76a7d65714870d883939326 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
NVL (MIN(days_since_last_positive), 0) AS days_since_last_positive | |
FROM ( | |
SELECT | |
order_id, | |
ROUND(trunc(sysdate) - to_date(specimen_received_datetime, 'YYYY-MM-DD"T"HH24:MI:SS'), 2) AS days_since_last_positive | |
FROM | |
covid.results | |
WHERE | |
tufts_person_id = '1295695' | |
AND result_value = 'POSITIVE' | |
ORDER BY | |
specimen_received_datetime DESC) | |
WHERE | |
rownum < 2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment