1. select 项目,品号,批号, sum(数量), sum(金额) from JSKLNA where 日期 between @begindate and @enddate and 项目号 = @ID group by 项目,品号,批号
2. select 项目,品号,批号,仓库, sum(数量), sum(金额) from JSKLNA where 日期 between @begindate and @enddate and 项目号 = @ID group by 项目,品号,批号,仓库
------解决方案--------------------
ISNULL(sum(case when LNA015=1 then ISNULL(LNA013,0) end),0) AS LNA013R,