Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RIGHT JOIN

Status
Not open for further replies.

bobmunkhouse

Technical User
Feb 23, 2003
14
US
I have a RIGHT JOIN on a query showing each of the names of teams. To the right of this there is a sum for each team of the amount they owe, and to the right of this is the standard fee that each team must pay on top of this. (see Query headings below):

TeamID MoneyOwed StandardFee

I've used a RIGHT JOIN so that a team will appear in the query even if they owe no money. The problem is that it shows no value under the MoneyOwed column if a team owes no money, rather than a "0". This is a problem because i need to make calculations using it, by adding the two fees together, but the null value just cancels out the Standard fee.

I hope you're not confused, please help me

Here is the SQL for my query if it helps:

SELECT StandardFee.TeamID, Sum(tblPayment.AmountDue) AS [Money Owed], StandardFee.AmountDue AS [Standard Fee]
FROM tblPayment RIGHT JOIN StandardFee ON tblPayment.TeamID = StandardFee.TeamID
GROUP BY StandardFee.TeamID, StandardFee.AmountDue;
 
try

Sum(
iif( isnull(tblPayment.AmountDue)
,0 ,tblPayment.AmountDue)
)


rudy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top