select order_num,count(order_num) as order_lines from OrderItems group by order_num order by order_lines
知识点:1、count(*),count(列名)都可以,区别在于,count(列名)是统计非NULL的行数2、order by最后执行,所以可以使用列别名3、分组聚合一定不要忘记加上 group by ,不然只会有一行结果