Created
December 27, 2019 14:53
-
-
Save javrasya/8cfe0bda9d145fa7984a3b63b01caa8c 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
SELECT | |
`date`, | |
COALESCE( | |
number, | |
LAST_VALUE(number, TRUE) OVER( | |
ORDER BY `date` | |
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW | |
) | |
) as last_not_null_number, | |
estimate, | |
COALESCE( | |
client, | |
LAST_VALUE(client, TRUE) OVER( | |
ORDER BY `date` | |
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW | |
) | |
) as last_not_null_client | |
FROM my_table; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment