運行選擇查詢後行的下面是我的查詢獲取否。受影響的SQL Server 2005中
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)[email protected]))
Group By c.InsuranceComp
Order By c.InsuranceComp
where @monNameStr is calculated date field like 'October 2009'
我需要知道什麼沒有。受此選擇查詢影響的記錄。
我不需要使用COUNT()函數將此查詢納入其他查詢。
您的寶貴幫助表示讚賞。
謝謝KM, 你是男人!!! – IrfanRaza 2009-10-09 13:25:33