I am fairly new to SQL. I am trying to solve the following question: Which supplier offer at least 20 plants and where the delivery time is less than 17 days. Show the supplier code and the number of distict plants. The supplier with the most plants is on top.
This is what I have (however I get no result).
select levCode, artCodeLev
from Offertes
where levertermijn < 17
group by artCodeLev, LevCode
having count(LevCode) > 20
I found the answer:
select Levcode, count(ArtCodeLev)
from Offertes
where levertermijn < 17
group by levCode
having count(*) > 20