Created
May 28, 2024 05:56
-
-
Save lfy79001/83fa72a46cc5aedb23d381f514c09cf4 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 | |
state_code, | |
evaluation_group, | |
evaluation_description, | |
state_name, | |
sum(macroplot_acres) + sum(subplot_acres) as total_acres, | |
latest | |
FROM (SELECT | |
state_code, | |
evaluation_group, | |
evaluation_description, | |
state_name, | |
macroplot_acres, | |
subplot_acres, | |
MAX(evaluation_group) OVER (PARTITION By state_code) as latest | |
FROM `bigquery-public-data.usfs_fia.estimated_timberland_acres` ) | |
WHERE evaluation_group = latest | |
GROUP by state_code, state_name, evaluation_description, evaluation_group, latest | |
order by state_name | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment