Solved

SQL: Find missing questions (in a group) in the answers table

Posted on 2011-09-20
2
169 Views
Last Modified: 2012-05-12
I have a questions table with questions that are grouped together.

20 questions belong to group 1
25 questions belong to group 2
18 questions belong to group 3

QuestionID(unique), QuestionGroup, Question

I need to find the questions in each group that are missing in the answers table

QuestionID, UserID, QuestionAnswer

The question I need to answer is: Which questions did the user  NOT answer in each question group. This is indicated by the missing rows in the answers table.

Thanks in advance for any help you can give
0
Comment
Question by:AWEInCA
  • 2
2 Comments
 
LVL 32

Expert Comment

by:ewangoya
ID: 36570673

select QuestionID, Question
from Questiontable
where not exists(select 1 from AnswerTable
                            where AnswerTable.QuestionID = QuestionTable.QuestionID
                            and UserID = 'User you are searching')
0
 
LVL 32

Accepted Solution

by:
ewangoya earned 500 total points
ID: 36570677
select QuestionID, QuestionGroup, Question
from Questiontable
where not exists(select 1 from AnswerTable
                            where AnswerTable.QuestionID = QuestionTable.QuestionID
                            and UserID = 'User you are searching')
order by QuestionGroup, QuestionID
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

829 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