我有一个桌子,上面放着一些菜,还有多少人喜欢每种菜。现在,表格是按菜名排序的,但我想按数量进行排序。
这是到目前为止我想出的代码:
SELECT dishes, COUNT(dishes) AS quantity FROM dishes
GROUP BY dishes;
答案 0 :(得分:1)
SELECT dishes, COUNT(dishes)
FROM dishes
GROUP BY dishes
ORDER BY COUNT(dishes);
答案 1 :(得分:0)
尝试一下:
SELECT dishes, COUNT(dishes) AS quantity FROM dishes
GROUP BY dishes
ORDER BY quantity;