I am new to Oracle and the SQL world. I have a slight issue with a query that I cannot figure out for the life of me, I have spent a few hours trying different approaches and I
I think the cleanest solution is to use the ALL comparison condition. It is used to compare a value to a list or subquery.
SELECT
m.mem_desc,
m.mem_max_rentals,
mh.mem_type,
COUNT(mh.mem_type) as membership_count
FROM membership_history mh
JOIN membership m ON m.mem_type = mh.mem_type
GROUP BY mh.mem_type,m.mem_desc,m.mem_max_rentals
HAVING membership_count >= ALL (
SELECT count(*)
FROM membership_history
GROUP BY mem_type
)