--find each sale for each city and state based on their yearly sale, and sum them all select *, sum(sale)over(partition by yyyy) from( select city,state, extract(year from order_date ) as yyyy, sum(sales)as sale from orders_table as ot where state = 'New York' group by 1,2,3 )t1
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter