以下是我的查询
select
@monNameStr as [MName],
IsNull(count(c.AssignmentID),0),
IsNull(sum(s.ACV),0),
IsNull(sum(s.GrossReturn),0),
IsNull(sum(s.NetReturn),0),
IsNull(avg(a.Total),0)
FROM
dbo.Assignment_ClaimInfo c,
dbo.Assignment_SettlementInfo s,
dbo.Assignment_AdvCharges a
Where
c.Assignmentid=s.Assignmentid and
s.Assignmentid=a.Assignmentid and
a.Assignmentid in
(select AssignmentID from dbo.Assignment_ClaimInfo
where (upper(InsuranceComp)=upper(@CompName) or upper(@CompName)='ALL COMPANIES')
and (DateName(month,DATEADD(month, 0, DOFileClosed))+' '
+cast(year(DATEADD(month, 0, DOFileClosed)) as varchar)=@monNameStr))
Group By c.InsuranceComp
Order By c.InsuranceComp
where @monNameStr is calculated date field like 'October 2009'
我需要知道什么没有。受此选择查询影响的记录数。
我不需要使用 Count() 函数将此查询嵌套到另一个查询。
感谢您的宝贵帮助。
将 @@ROWCOUNT 捕获到变量中,因为每次选择它时它都会更改值:
DECLARE @Rows int
---your query here
SELECT @Rows=@@ROWCOUNT
然后你可以根据需要使用它@Rows
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)