CDA128983
2022-11-09 阅读量: 222
-- 聚合函数用于开窗函数
-- 查询订单总金额
select sum(amount) as 订单总金额 from order_tab;
select *,sum(amount) over() as 订单总金额 from order_tab;
-- 查询每个用户的订单总金额
select user_no,sum(amount) as 订单总金额
from order_tab
group by user_no;