DEV Community

Discussion on: #SQL30 Day 1: Wildfires

Collapse
 
saurabhsikchi profile image
Saurabh Sikchi

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;

Collapse
 
zchtodd profile image
zchtodd

Nice! I think of window functions as the heavy artillery... not always necessary when a group by might do the job.