Been working through postgres exercises; there are some that are straight forward and others with multiple solutions. An example of this is the below.
Find the count of members who have made at least one booking
Question findable here
the more ineffective way to do this. (my first pass)
select count(1) from cd.members
where memid
IN (select memid from cd.bookings
where slots is not null)
you can group them easier by checking distinct counts and doing the below. ( the distinct is a subquery)
select count(distinct memid) from cd.bookings
.
Top comments (0)