sql-query for the "show answers" button

More
1 month 1 week ago #160350 by shiva522
shiva522 created the topic: sql-query for the "show answers" button
Hello.

Tell me how the sql query is implemented in which information about the responses is displayed: the "show answers" button?

I looked at the mysql tables.

The answer values ​​are stored in one row of the table lime_survey_xxxxxx, where xxxxxx are certain digits.

Response information for each respondent is stored in one line. The column names with the responses are a cipher based on the columns in the lime_questions table:

- sid
- parent_qid
- gid
- title

If the table lime_survey_xxxxxx would contain fields:

- sid
- parent_qid
- gid
- title

and the field for the answer could be built about such a sql-query:

select ... from lime_questions, lime_survey_xxxxxx
where
lime_questions.sid = lime_survey_xxxxxx .sid
lime_questions.parent_qid = lime_survey_xxxxxx.parent_qid
lime_questions.gid = lime_survey_xxxxxx.gid
lime_questions.title = lime_survey_xxxxxx.title

but the structure of the table lime_survey_xxxxxx is different and I do not understand how to display the information with the "show answers".


Please tell me how it is done

Best regards

Please Log in to join the conversation.

More
1 month 1 week ago #160353 by Joffm
Joffm replied the topic: sql-query for the "show answers" button
fvanderstarre said in your previous thread about this (why did you open a new one?)

sid-valueXgid-value-Xqid-value, so for example you can have: 998853X2490X44648


So in the data table "lime_survey_998853"
you find this column.
sid=998853
gid=2490
qid=44648

Now you find in table "lime_questions" the question text "WHERE sid=998853 and qid=44648";
if parent_qid!=0 it is a question with subquestions and the parent_id contains the qid of your data table.
In the data table there is no "parent_qid". So that might be a bit tricky.

In "lime_answers" you find the answer options of single punch questions. query "WHERE qid=XXX AND code=[given_answer]"

Well, the rest is sql.
Maybe you try to ask this in a MySQL-forum how to combine this.
Regards
Joffm

Please Log in to join the conversation.

More
1 month 1 week ago - 1 month 1 week ago #160364 by shiva522
shiva522 replied the topic: sql-query for the "show answers" button
About the last topic, I figured it out. I can even add that the value of "11" in X11X was formed entirely from lime_questions.GID not from sid-valueXgid-value-Xqid-value

But the question is not about that.

Probably I did not correctly put it.

I'm interested in how the sql query is organized for the "show answers" button. Interested in how to link the names of questions, groups and response codes with the answers displayed below in the form of a table?
Last Edit: 1 month 1 week ago by shiva522.

Please Log in to join the conversation.

More
1 month 6 days ago #160432 by DenisChenu
DenisChenu replied the topic: sql-query for the "show answers" button
? All LimeSurvey code is public : code is surely here : github.com/LimeSurvey/LimeSurvey/blob/ma.../admin/questions.php

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
1 month 5 days ago #160470 by shiva522
shiva522 replied the topic: sql-query for the "show answers" button
Thanks

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!