subquery aggregation

Solutions on MaxInterview for subquery aggregation by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "subquery aggregation"
Chayma
12 Feb 2020
1select name, revenue from (
2	select facs.name, sum(case 
3				when memid = 0 then slots * facs.guestcost
4				else slots * membercost
5			end) as revenue
6		from cd.bookings bks
7		inner join cd.facilities facs
8			on bks.facid = facs.facid
9		group by facs.name
10	) as agg where revenue < 1000
11order by revenue;          
queries leading to this page
subquery aggregationsubquery aggregation