请教大佬一个问题
sql吧
全部回复
仅看楼主
level 2
冯二岁11 楼主
select 提取(同一单位,单位进货名称,数量),然后怎么把相同的进货名称后面的数量相加?
2021年01月11日 03点01分 1
level 2
冯二岁11 楼主
select 单位,单位进货名称。进货数量
from 视图表
where 单位ID=100
然后相同名称后面的进货数量需要相加。(sum函数怎么用啊)
2021年01月11日 03点01分 2
level 8
select 单位,单位进货名称,sum(进货数量) 进货数量
from 视图表
where 单位ID=100
GROUPBY 单位,单位进货名称
2021年01月11日 03点01分 3
您好,能不能麻烦你帮我看一下,下面那里出现问题了,名称还是有相同的
2021年01月11日 03点01分
select x.customid,x.customname,x.goodsname,x.goodsqty,x.credate,s.medicinesort --提取名称ID,单位名称,货品名称,数量,时间,货品分类 from bms_sa_con_dtlqry_v x,pub_goods_v s --客户表,销售表
2021年01月11日 06点01分
where x.goodsname = s.goodsname --客户表与销售表关联 and x.customid = 2038 --客户ID and s.medicinesort in (1,2) --货品类别
2021年01月11日 06点01分
and x.credate between to_date('2020-01-01','yyyy-mm-dd') and to_date('2020-12-31','yyyy-mm-dd') --限定时间 order by goodsname
2021年01月11日 06点01分
level 7
select 单位进货名称,sum(进货数量)
from 视图表
where 单位ID=100 group by 单位进货名称
2021年01月13日 03点01分 6
发现大佬
2021年01月15日 02点01分
2021年01月18日 23点01分
[哈哈]
2021年03月19日 08点03分
吧务
level 14
[呵呵]
2021年02月02日 06点02分 7
1