题解 | #返回订单数量总和不小于100的所有订单的订单号#
返回订单数量总和不小于100的所有订单的订单号
http://www.nowcoder.com/practice/ff77e82b59544a15987324e19488aafd
SELECT a.order_num FROM (SELECT order_num,SUM(quantity)AS num FROM OrderItems GROUP BY order_num)AS a WHERE num>100 ORDER BY a.order_num; 可用子查询先将符合条件的筛选出来;也可用HAVING将条件直接筛选