Created
February 19, 2022 20:43
-
-
Save James-McNeill/0e26bc1970ecf6d136b0623895a3dfdc 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
-- Analytical functions (Other) | |
SELECT *, | |
LEAD(t1.Value) | |
OVER( | |
PARTITION BY t1.Area, t1.Property_type | |
ORDER BY t1.Date | |
) leadValue, | |
LEAD(t1.Value, 1, 0) | |
OVER( | |
PARTITION BY t1.Area, t1.Property_type | |
ORDER BY t1.Date | |
) leadValueZero, | |
FIRST_VALUE(t1.Value) | |
OVER( | |
PARTITION BY t1.Area, t1.Property_type | |
ORDER BY t1.Date | |
) firstValue, | |
LAST_VALUE(t1.Value) | |
OVER( | |
PARTITION BY t1.Area, t1.Property_type | |
ORDER BY t1.Date | |
RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING | |
) lastValue | |
FROM Medium.dbo.HPM09_202112 AS t1 | |
WHERE t1.Value > 0 | |
AND t1.Date BETWEEN '2020-01-01' AND '2020-06-01' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment