Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select member,facility,cost from (select mem.firstname || ' ' || mem.surname as member,
- fac.name as facility,
- (select case when mem.memid=0
- then book.slots*fac.guestcost
- else book.slots*fac.membercost
- end
- ) as cost
- from cd.members as mem join cd.bookings as book on book.memid=mem.memid
- join cd.facilities as fac on fac.facid=book.facid
- where book.starttime >= '2012-09-14' and book.starttime < '2012-09-15') as t
- where cost > 30 order by cost desc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement