====== Notes on LimeSurvey ======
===== Table Structure =====
==== Tables with Survey Id - sid column name ====
^Column Name^Position^
|lr_surveys|1|
|lr_survey_permissions|1|
|lr_assessments|2|
|lr_groups|2|
|lr_quota|2|
|lr_quota_members|2|
|lr_saved_control|2|
|lr_questions|3|
==== Tables with Question Id - qid column name ====
^Column Name^Position^
|lr_questions|1|
|lr_defaultvalues|1|
|lr_answers|1|
|lr_conditions|2|
|lr_question_attributes|2|
|lr_quota_members|3|
==== Tables with Group Id - gid column name ====
^Column Name^Position^
|lr_groups|1|
|lr_assessments|4|
|lr_questions|4|
===== SQLs used to get Table Structure =====
SELECT * FROM `COLUMNS` WHERE `TABLE_SCHEMA` = 'a22_limesurvey' and column_name = 'sid'
SELECT concat('|',table_name,'|',ORDINAL_POSITION,'|') FROM `COLUMNS`
WHERE `TABLE_SCHEMA` = 'a22_limesurvey' and column_name = 'gid'
order by COLUMN_KEY desc, ORDINAL_POSITION, TABLE_NAME
SELECT concat('|',table_name,'|') FROM `COLUMNS` WHERE `TABLE_SCHEMA` = 'a22_limesurvey' and column_name = 'qid'
select group_name, question, code, answer
from
lr_groups, lr_questions, lr_answers
where
lr_groups.gid = lr_questions.gid
and
lr_answers.qid = lr_questions.qid
and
lr_questions.sid = 88593
order by group_order, question_order, sortorder
select group_name, question
from
lr_groups, lr_questions
where
lr_groups.gid = lr_questions.gid
and
lr_questions.sid = 88593
order by group_order, question_order