Answers for "subquery aggregation"

SQL
0

subquery aggregation

select name, revenue from (
	select facs.name, sum(case 
				when memid = 0 then slots * facs.guestcost
				else slots * membercost
			end) as revenue
		from cd.bookings bks
		inner join cd.facilities facs
			on bks.facid = facs.facid
		group by facs.name
	) as agg where revenue < 1000
order by revenue;
Posted by: Guest on August-25-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language