Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

sql-query for the "show answers" button

  • shiva522
  • shiva522's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 5 months ago #160350 by shiva522
sql-query for the "show answers" button was created by shiva522
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
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 5 months ago #160353 by Joffm
Replied by Joffm on 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

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • shiva522
  • shiva522's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 5 months ago - 6 years 5 months ago #160364 by shiva522
Replied by shiva522 on 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: 6 years 5 months ago by shiva522.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 5 months ago #160432 by DenisChenu
Replied by DenisChenu on 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 , plugin development .
I don't answer to private message.
The topic has been locked.
  • shiva522
  • shiva522's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 5 months ago #160470 by shiva522
Replied by shiva522 on topic sql-query for the "show answers" button
Thanks
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose