a.fias as fias,
a.personal_account as personal_account,
q.name as questionary_name,
qc.name as question_with_choice,
ac.data as choosen_answer,
qt.name as question_with_text,
t.text as text_answer
FROM answer a
INNER JOIN questionary q on a.questionary_id = q.id
LEFT JOIN answer_choice ac on a.id = ac.answer_id
LEFT JOIN question_choice qc on ac.question_choice_id = qc.id
LEFT JOIN answer_text at on a.id = at.answer_id
LEFT JOIN question_text qt on at.question_text_id = qt.id
ORDER BY a.id
Пытаюсь переделать в такую структуру
fias,
personal_account,
questionary_name,
question,
answer
Т.е. в question доставать или qc.name или qt.name и в answer ac.data или at.text соотвествеено.
такое возможно провернуть?
Это альтернативные варианты?
Обсуждают сегодня