mysql - SQL SELECT Query based on yes or no questions -
i have 2 question sets. 1 yes or no questions. based on question's answers need display set of questions. have added question code yes or no questions. , second set questions given these question codes identify displaying question or not.
for example y/n questions - question code 1.aaaaaaaa - aaa 2.bbbbbbbb - bbb 3.cccccccc - ccc second set questions - question code 1.xxxxxxxx - aaa && bbb 2.yyyyyyyy - aaa && !bbb 3.zzzzzzzz - aaa && !bbb && ccc so second set question number 1 display if y/n question number 1 , 2 answer yes. question number 2 display if y/n question number 1 answer yes , number 2 answer no. question number 3 display if y/n question number 1 answer yes, number 2 answer no , number 3 answer yes.
how can write query displaying second set of questions display based on y/n question answers.
another approach normalize tables. 2nd table's 2nd column should associative (many-to-many) table between first , second set of questions. in place query simpler.
Comments
Post a Comment