Answer the question
In order to leave comments, you need to log in
How to display the maximum number of satellites for the planet?
select * from ( select NAME as `Название планет` , COUNT(Sputnik.Planet_idPlanet) as `Количество спутников` from Planet
inner join Sputnik on Planet.idPlanet = Sputnik.Planet_idPlanet
group by Sputnik.Planet_idPlanet ) as `results`
Where...;
Answer the question
In order to leave comments, you need to log in
select `results`.`Название планет`, max(`results`.`Количество спутников`) from ...
I would denormalize the number of satellites into a planet property. The solution is trivial.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question