May 28, 2011 at 3:55 am
Select A.CRT_Cod,A.CP_Nm,A.TSM,A.TSM_No,A.Lead,A.DSR_NM,A.DSR_no,A.Business_category as 'Trans_Typ', AMOUNT_AVAILABLE as 'Opening_Bal',
SUM (A.ERC_TO_BE_BILD_2DAY) 'Bal_Loading_Target',
SUM (case when MRP not in ('0','','Null') then A.MRP End ) 'Tran_Frm_DSR_to_Ret',
Count (case when MRP not in ('0','','Null') then A.MRP End ) '#Ret'
from BNG_BAL_TDAY A
Left Outer JOIN Balance B on A.DSR_no = B.Donor_MDN
Where A.Business_category = 'CDMA' and day(B.date)=day(getdate()-2) and B.BUSINESS_CATEGORY in ('CDMA')
Group By A.CRT_Cod,A.CP_Nm,A.TSM,A.TSM_No,A.Lead,A.DSR_NM,A.DSR_no,A.Business_category,AMOUNT_AVAILABLE
Thanks & Regards
Sabari
May 28, 2011 at 4:15 am
Duplicate post. No replies to this thread please. Direct replies to:http://www.sqlservercentral.com/Forums/Topic1116627-338-1.aspx
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply