Perhaps some can provide a lead / suggestion on how I can approach this problem.
I have a database which records people's answers to questions (basically a survey). There are 3 main tables, person, personAnswer and question. personAnswer is a many to many containing the question id, person id, and the answer text (foreign keys to the person table and the question table).
Basically I need to develop a statement that will allow to select a single person based on her answer to multiple questions. For example he answered yes to question id 5 and no to question id 6. The statement I am trying to develop would need to be scalable (i.e. for 3,4,5 or more separate questions). Is this possible or do the queries need to be run separately and then joined in php or otherwise?
Any suggestions? Joins? Unions? Something else?
Cheers,
Tyler
I have a database which records people's answers to questions (basically a survey). There are 3 main tables, person, personAnswer and question. personAnswer is a many to many containing the question id, person id, and the answer text (foreign keys to the person table and the question table).
Basically I need to develop a statement that will allow to select a single person based on her answer to multiple questions. For example he answered yes to question id 5 and no to question id 6. The statement I am trying to develop would need to be scalable (i.e. for 3,4,5 or more separate questions). Is this possible or do the queries need to be run separately and then joined in php or otherwise?
Any suggestions? Joins? Unions? Something else?
Cheers,
Tyler