Answer the question
In order to leave comments, you need to log in
How does the MAX function work?
SELECT maker, MAX(type)
FROM product
GROUP BY maker
HAVING COUNT(DISTINCT type) = 1 AND COUNT(model) > 1
Answer the question
In order to leave comments, you need to log in
Since the query implies the output of groups in which there is only one type :
then MAX(type) in this case is a kind of "trick" to AND collapse into groups AND not group by two fields (maker, type).
With the same success, you can put MIN(type) there . the result will not change.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question