我要将当前组CONCAT中不同表中的两列连接起来:
SELECT MAX(unit.unit_pk) AS unit_pk,
GROUP_CONCAT(unit_outcome.unit_outcome SEPARATOR '|') unit_outcomes,
MAX(program_outcome.program_outcome) program_outcome,
GROUP_CONCAT(unit_outcome.unit_outcome_pk) unit_outcome_pks,
program_outcome.program_outcome_pk,
program_outcome.program_outcome
FROM unit
INNER JOIN unit_unit_outcome_lookup
ON unit_unit_outcome_lookup.unit_fk = unit.unit_pk
INNER JOIN unit_outcome
ON unit_outcome.unit_outcome_pk = unit_unit_outcome_lookup.unit_outcome_fk
INNER JOIN program_outcome_unit_outcome_lookup
ON program_outcome_unit_outcome_lookup.unit_outcome_fk = unit_outcome.unit_outcome_pk
INNER JOIN program_outcome
ON program_outcome.program_outcome_pk = program_outcome_unit_outcome_lookup.program_outcome_fk
GROUP BY program_outcome_pk ORDER BY program_outcome.program_outcome ASC
以便
GROUP_CONCAT(unit_outcome.unit_outcome SEPARATOR '|') unit_outcomes
unit.unit_code
和
unit_outcome.unit_outcome
在里面
GROUP_CONCAT
我要找的结果是一个来自组CONCAT的字符串,比如“unit-code:unit-outcome”
db fiddle