mysql summarizes multiple data into one data
怪我咯
怪我咯 2017-06-08 11:03:28
0
1
827

3 tables
1. Question table tbl_question
id, fk_qnid (questionnaire id, unified to 1), questionName
2. Question option table tbl_answer
id, fk_qnid (questionnaire id, unified is 1), fk_qid (question id), answerName (option name)
3. Questionnaire answer table tbl_question_deail
id, openid (unique identification of the answering user), fk_qnid (questionnaire id, unified to 1), fk_qid( question id), fk_aid (answer id), remark (questionnaire questions are not multiple-choice questions, but records of fill-in-the-blank questions)


The actual data is as shown above
When the user fills in the questionnaire, there will be one more record for the single-choice question. If the user selects multiple choices for the multiple-choice question, there will be more records. Answer questions If fk_aid is empty, remark records the answer filled in by the user.
According to this table, how to obtain the answer status of each user
How to write the sql statement so that each user can have one row of data. Multiple selection can be used Comma separated

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
phpcn_u1582

Questions without test data are just hooligans

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!