I think my query is quite a bit easier than WINDOWing and CTE:
SELECT w1.* FROM day1.wildfire w1 INNER JOIN ( SELECT cause, MAX(acres) as max_acres FROM day1.wildfire GROUP BY cause ) w2 ON w1.cause = w2.cause AND w1.acres = w2.max_acres;
Nice! I think of window functions as the heavy artillery... not always necessary when a group by might do the job.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I think my query is quite a bit easier than WINDOWing and CTE:
SELECT w1.*
FROM day1.wildfire w1
INNER JOIN ( SELECT cause, MAX(acres) as max_acres FROM day1.wildfire GROUP BY cause ) w2
ON w1.cause = w2.cause AND w1.acres = w2.max_acres;
Nice! I think of window functions as the heavy artillery... not always necessary when a group by might do the job.