Skip to content
Advertisement

How to find distinct columns in a nested subquery in SQL?

I need to find the distinct drinkers that ordered ‘VODKA’ and ‘WHISKY’. I AM ONLY ALLOWED TO USE A NESTED QUERY. No other format is accepted.

I am quite new to sql so any help would be greatly appreciated! Here are the tables I am trying to retrieve data from:

Here is my SELECT statement so far:

INSERT STATEMENTS:

DESIRED OUTPUT:

Advertisement

Answer

You could use an hanving for count distinct drink group by DRINKER

or if you need a nested

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