列 'C.ShL' 在选择列表中无效,因为该列既不包含在聚合函数中,也不包含在 GROUP BY 子句中。
selectsum(B.Shu1)asHe,B.KCID,C.ShLfromBleftjoinConB.KCID=C.KCIDgroupbyB.KCIDwhere(B.S...
select sum(B.Shu1)as He,B.KCID,C.ShL from B left join C on B.KCID=C.KCID group by B.KCID
where
(B.ShiJian between '2014-02-02' and '2014-02-14') group by B.KCID,C.ShL 展开
where
(B.ShiJian between '2014-02-02' and '2014-02-14') group by B.KCID,C.ShL 展开
1个回答
展开全部
把提示的列补上group by B.KCID,C.ShL
更多追问追答
追问
谢谢您的回答,我想再问一下。select B.KCID,sum(B.Shu1)as He,C.ShL, sum(B.Shu1)+C.ShL as ZHe,sum(Cast(B.Shu1 as float))/(sum(B.Shu1)+C.ShL) as BaiFenBi from B
left join C on B.KCID=C.KCID
追答
你问了什么?凡是带有聚合函数的语句,不包含在聚合函数中的列,就必须包含在group by列表中
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询