We help IT Professionals succeed at work.

How can I include NULL records in my query?

Chadd C
Chadd C asked
on
281 Views
Last Modified: 2014-05-16
I have two tables:

Loaded Questions: contains all the questions in my survey (as well as targeted sample size). Structure is:
Question_ID (unique/primary key)
Issue (serves as the category)
Question (the question)
Sample_Size (total number of responses we need for that particular question)

cs13_qc: contains all the responses
Question  (unique/primary key associated with Question_ID for the question (In Loaded Questions).
Response (response)


What I am attempting to accomplish is a query that will list ALL the questions loaded in the "Loaded Questions" table and their targeted sample size, a [count] of associated responses to each question listed in the cs13_qc table, and a calculation of the difference [status].  Here is my code thus far:

SELECT [Loaded Questions].Question_ID, [Loaded Questions].Issue, [Loaded Questions].Question, [Loaded Questions].Sample_Size, Count(cs13_qc.Question) AS [Count], [Count]-[Sample_Size] AS Status
FROM [Loaded Questions] INNER JOIN cs13_qc ON [Loaded Questions].Question_ID = cs13_qc.Question
GROUP BY [Loaded Questions].Question_ID, [Loaded Questions].Issue, [Loaded Questions].Question, [Loaded Questions].Sample_Size, [Count]-[Sample_Size];

Open in new window


All seems to work expect that the query only lists those questions that have received a response. Those questions that have no response are not appearing in the query. How do I fix it so that they appear with a value of "0"?
Comment
Watch Question

Shaun KlineLead Software Engineer
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Infotrakker Software
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.