BigRed1212
Technical User
Hey and Hello,
Given a table of survey responses from two dummy responders (I have more than two):
table:dummy_responses
[pre]code ques_elem response
001669 1 3
001669 2 3
001669 3 3
001669 4 3
001669 5 3
001669 6 3
001669 7 3
001669 8 3
007265 1 2
007265 2 2
007265 3 2
007265 4 2
007265 5 2
007265 6 2
007265 7 2[/pre]
one can see that responder 001669 responded to all 8 question elements whereas responder 007265 only provided data for 7.
I also have a table that defines the possible responses:
table:ques_1
[pre]questext quesvalue
One-on-one 1
Group presentation 2
Online 3
Social media 4
Cell phone app 5
Email 6
Printed materials 7
Other 8[/pre]
So that we know for ques1 there are 8 response areas, ques2 has 6 I think and so on, I have a table for each question.
What I want is a query that essentially adds an additonal row to the first table that looks like:
[pre]code ques_elem response
007265 8 0[/pre]
The zero can be a null, I don't care, I just need 8 response records for each responder to any part of this question for a nice regular uniform layout. Gotta graph and present it.
select b.*
from ques1 a left join dummy_responses b
on a.quesvalue = b.ques_elem
where b.ques_elem is null
gets me nothing and I don't think it should.
In short, I think somehow I want to identify responders in dummy_responses that haven't provided data for each quesvalue (maybe they skipped 2 instead of 8), create a record with that queselem and a zero or null as a response for each of those, and then union that up with the actual responses to create my uniform set, but I don't see how to do it.
Thoughts, ideas, tips, suggestions, help?
Thanks.
Given a table of survey responses from two dummy responders (I have more than two):
table:dummy_responses
[pre]code ques_elem response
001669 1 3
001669 2 3
001669 3 3
001669 4 3
001669 5 3
001669 6 3
001669 7 3
001669 8 3
007265 1 2
007265 2 2
007265 3 2
007265 4 2
007265 5 2
007265 6 2
007265 7 2[/pre]
one can see that responder 001669 responded to all 8 question elements whereas responder 007265 only provided data for 7.
I also have a table that defines the possible responses:
table:ques_1
[pre]questext quesvalue
One-on-one 1
Group presentation 2
Online 3
Social media 4
Cell phone app 5
Email 6
Printed materials 7
Other 8[/pre]
So that we know for ques1 there are 8 response areas, ques2 has 6 I think and so on, I have a table for each question.
What I want is a query that essentially adds an additonal row to the first table that looks like:
[pre]code ques_elem response
007265 8 0[/pre]
The zero can be a null, I don't care, I just need 8 response records for each responder to any part of this question for a nice regular uniform layout. Gotta graph and present it.
select b.*
from ques1 a left join dummy_responses b
on a.quesvalue = b.ques_elem
where b.ques_elem is null
gets me nothing and I don't think it should.
In short, I think somehow I want to identify responders in dummy_responses that haven't provided data for each quesvalue (maybe they skipped 2 instead of 8), create a record with that queselem and a zero or null as a response for each of those, and then union that up with the actual responses to create my uniform set, but I don't see how to do it.
Thoughts, ideas, tips, suggestions, help?
Thanks.