Skip to content
Advertisement

How to select maximum discount for each family?

I am trying to write a query to print the maximum number of discounted tours any one family can choose from. For example, the Thomas family can choose from any of the 3 tours and qualify for the discount. The Chris family only qualifies for 1.

Below is the Country table:

Below is the Family table:

Here is my code but I think it’s incorrect even though it runs okay. Thank you in advance.

Advertisement

Answer

You can use inner join (to make the query more readable) and name in group by clause.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement