Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to filter a join
Message
De
24/04/2013 17:14:28
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
How to filter a join
Divers
Thread ID:
01571814
Message ID:
01571814
Vues:
56
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform