Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. select member,facility,cost from (select mem.firstname || ' ' || mem.surname as member,
  2. fac.name as facility,
  3. (select case when mem.memid=0
  4. then book.slots*fac.guestcost
  5. else book.slots*fac.membercost
  6. end
  7. ) as cost
  8. from cd.members as mem join cd.bookings as book on book.memid=mem.memid
  9. join cd.facilities as fac on fac.facid=book.facid
  10. where book.starttime >= '2012-09-14' and book.starttime < '2012-09-15') as t
  11. where cost > 30 order by cost desc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement