当前位置: 代码迷 >> Sql Server >> !分少不好意思
  详细解决方案

!分少不好意思

热度:138   发布时间:2016-04-27 19:30:46.0
请教高手!~分少不好意思,
运行 rs.open"select proName,sum(A),sum(B),(select proName,sum(A-B)from tb where y=<4 group by proName) from tb where y=<5 group by proName ",con,ad....,ad....

提示 当没有引用EXISTS 子查询时 选择列表只能有一个表达式 
如何 修改呢

------解决方案--------------------
select proName,sum(A),sum(B),(select proName,sum(A-B)from tb where y= <4 group by proName) from tb where y= <5 group by proName

上面这句SQL出錯,試下下面的是不是你要的
select proName,sum(A),sum(B),
(select sum(A-B) from tb where y= <4 and proname=A.proname) 
from tb A
where y= <5 group by proName
  相关解决方案