Holen Sie sich MAX aus einer GROUP BY

Ich habe SQL geübt, als mich das traf. Ich wollte sehen, wie oft eine bestimmte Ware aufgetaucht ist und von dort die Ware bekommen, die aufgetaucht istam meisten.

Dies zeigt, wie oft jede Ware auftaucht:

mysql> SELECT commodity, COUNT(commodity) count FROM orders GROUP BY commodity ORDER BY count;
+----------------------+------------+
| commodity            |    count   |
+----------------------+------------+
| PERSIAN MELON        |          4 |
| BEANS                |          6 |
| CASABA               |         10 |
| ASPARAGUS            |         11 |
| EGGPLANT             |         12 |
| TOMATOES, CHERRY     |         16 |
| GALIA MELON          |         18 |
+-----------------------------------+

Ich versuche die Reihe mit der höchsten zu bekommen, aber es ist alles falsch:

mysql> SELECT commodity, MAX(COUNT(commodity)) count FROM orders GROUP BY commodity ORDER BY count;

Wie geht das richtig?

Antworten auf die Frage(5)

Ihre Antwort auf die Frage