读书人

!分少不好意思

发布时间: 2012-04-05 12:42:40 作者: rapoo

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

读书人网 >SQL Server

热点推荐