Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to filter a join
Message
From
24/04/2013 17:14:28
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
How to filter a join
Miscellaneous
Thread ID:
01571814
Message ID:
01571814
Views:
57
Hello -

I am trying to write a SQL select. My goal should be obvious from my code.
select b.RTAElement, a.tipid, rtaid, a.projectname, sponsor, developmentstatus, SUM(c.amount) as RTACommitted, SUM(d.amount) as RTASpent
from TIP_ProjectS a 
inner join RTA_GeneralInfo b on a.TipID = b.tipid
left join TIP_ApprovedFunding c on a.TipID = c.tipid and c.FundType = 'RTA'
left join TIP_Ledger d on a.TipID = d.tipid and d.FundType = 'RTA'
group by b.RTAElement, a.tipid, rtaid, a.projectname, sponsor, developmentstatus
order by RTAid
At present, it is not correct as I want the 2 sum amounts to only include FundTypes 'RTA'. Can someone help me filter the sums but not drop any records where the sum might be null or zero?
Thanks
Next
Reply
Map
View

Click here to load this message in the networking platform