Answer the question
In order to leave comments, you need to log in
How to get max. values when grouping MySQL?
A query without grouping gives this result. On the left id on the right is the quantity.
If you group GROUP BY id, then the amount is not the maximum in the result. I don’t know how to sort before grouping, because ORDER BY must come after GROUP BY and it already contains the minimum values and in the singular.
UP:
SELECT table1.id, table2.members
FROM table1
INNER JOIN table2 ON table2.id = table1.id WHERE table2.members > 400 GROUP BY id
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question