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