Я пытаюсь объединить 3 таблицы и выполнить GROUP_CONCAT, но получить
Unknown column 'program_outcome.program_outcome_pk' in 'field list'
Запрос:
SELECT program_outcome.program_outcome_pk,
program_outcome.program_outcome,
GROUP_CONCAT(program_outcome_unit_outcome_lookup.unit_outcome_pk) unit_outcome_pks,
GROUP_CONCAT(unit_outcome.unit_outcome) unit_outcomes
FROM program_outcome po
LEFT JOIN program_outcome_unit_outcome_lookup pouo
ON po.program_outcome_pk = pouo.program_outcome_fk
LEFT JOIN unit_outcome uo
ON pouo.unit_outcome_fk = uo.unit_outcome_pk
GROUP BY po.program_outcome_pk,
po.program_outcome
Результаты, которые я ищу, выглядят так:
+----------------------------------+--------------------------------------------------+
| program_outcome.program_outcome | unit_outcome.unit_outcome |
+----------------------------------+--------------------------------------------------+
| program outcome 1 | unit_outcome 2, unit_outcome 5 |
| program outcome 2 | unit_outcome 7, unit_outcome 1 |
| program outcome 3 | unit_outcome 1, unit_outcome 9, unit_outcome 11 |
+----------------------------------+--------------------------------------------------+
дБ скрипка