如何使用sql统计某一个字段的总和

2025-03-14 00:24:12
推荐回答(2个)
回答1:

按编号分组
select 编号,sum(数量) from 表 where 条件 group by 编号
不分组
select sum(数量) from 表 where 条件

回答2:

select sum(数量) from table_name where condition