日期:2014-05-18  浏览次数:20444 次

请教高手!~分少不好意思,
运行 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