Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Unable to figure out SQL Query to question

$
0
0

RELATED:

Person1_UID Person2_UID   Type1           2             club member1           9             family1           11            colleague2           4             friend2           7             colleague3           4             club member3           6             colleague3           9             friend3           10            follower4           6             family4           10            family5           8             family6           11            colleague7           8             colleague8           11            friend

DAY_PACKAGE:

DID Description    UID  VID1   Spa Day         1   191   Spa Day         2   201   Spa Day         9   172   Adventure Time  4   162   Adventure Time  6   163   Family Fun Day  3   183   Family Fun Day  4   173   Family Fun Day  7   183   Family Fun Day  10  194   Relaxation Date 5   20UID: User IDDID: Day Package IDVID: 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_Count1   Spa Day         32   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_CountFROM DAY_PACKAGEGROUP BY DescriptionORDER BY Participants_Count DESC

Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>