select order_num from OrderItems group by order_num having sum(quantity) >= 100 order by order_num
使用having条件语句,附加SQL执行的顺序:
From..... → where条件语句 → group by 分组 → 聚合函数计算 → having条件语句 → order by 排序语句
select order_num from OrderItems group by order_num having sum(quantity) >= 100 order by order_num
使用having条件语句,附加SQL执行的顺序:
From..... → where条件语句 → group by 分组 → 聚合函数计算 → having条件语句 → order by 排序语句