RELATED:
Person1_UID Person2_UID Type
1 2 club member
1 9 family
1 11 colleague
2 4 friend
2 7 colleague
3 4 club member
3 6 colleague
3 9 friend
3 10 follower
4 6 family
4 10 family
5 8 family
6 11 colleague
7 8 colleague
8 11 friend
DAY_PACKAGE:
DID Description UID VID
1 Spa Day 1 19
1 Spa Day 2 20
1 Spa Day 9 17
2 Adventure Time 4 16
2 Adventure Time 6 16
3 Family Fun Day 3 18
3 Family Fun Day 4 17
3 Family Fun Day 7 18
3 Family Fun Day 10 19
4 Relaxation Date 5 20
UID: User ID
DID: Day Package ID
VID: Voucher ID
Given the above tables, find the day packages with highest participant count where all participants are related to one another as either ‘family’ or ‘club members’.
The query should return:
DID Description Participant_Count
1 Spa Day 3
2 Adventure Time 2
Please assist me any kind soul, thank you! I have been stuck at this for hours. T-T
I only know how to return total participant count:
SELECT Description, COUNT(DISTINCT UID) AS Participants_Count
FROM DAY_PACKAGE
GROUP BY Description
ORDER BY Participants_Count DESC
George Lai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.