Solved

I have a join Query that Returns Nulls. Is There a Way to Make it Return Zeroes instead of Nulls?

Posted on 2011-09-09
4
240 Views
Last Modified: 2012-05-12
I have a join query that returns nulls. (Code posted below)

I would like the nulls to show as zeroes instead of just empty values.

The QPR_Intersuhl_QNs_tbl is the table with the gaps that show up as nulls. I would like the Total_QMs field to return a zero if the value for that field is a null.
SELECT QPR_Interstuhl_QNs_tbl.WeekEndingDate, QPR_Interstuhl_QNs_tbl.Total_QNs, Possible_Week_Ending_Dates_Tbl.PossibleWeekEndingDates
FROM QPR_Interstuhl_QNs_tbl RIGHT JOIN Possible_Week_Ending_Dates_Tbl ON QPR_Interstuhl_QNs_tbl.WeekEndingDate = Possible_Week_Ending_Dates_Tbl.PossibleWeekEndingDates;

Open in new window

0
Comment
Question by:Rex85
  • 2
  • 2
4 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 36513042
Wrap those other fields in the NZ() function.

SELECT NZ(QPR_Interstuhl_QNs_tbl.WeekEndingDate, 0), NZ(QPR_Interstuhl_QNs_tbl.Total_QNs, 0)

Although I'm not sure why you would want to display a zero for a blank date field.
0
 

Author Comment

by:Rex85
ID: 36513058
It's the one field ... Total QNs that needs to be a zero. It is essentially a count of complaints
0
 

Author Closing Comment

by:Rex85
ID: 36513069
that did it. thanks again! (I only used it on the one field.)
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 36513071
as recommended, use the NZ() function.  NZ stands for NullToZero.  By default it is supposed to return a zero if you don't pass it the optional value, but I generally provide it the 0 anyway.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now