题解 | #计算总和#
计算总和
https://www.nowcoder.com/practice/d8a624021183454586da94d280cc8046
select
order_num,
sum(item_price * quantity) total_price
from
OrderItems
group by
order_num
having total_price >= 1000
order by
order_num asc
- where后面不能直接加聚合函数(分组函数),我们也可以这样记忆:where后面只能跟表中存在的字段。
- having 不能单独使用,必须跟 group by 联合使用。
CVTE公司福利 716人发布