我正在使用下面的查询,它非常接近我需要的东西,除了我需要GROUP_CONCAT子查询在一列中创建唯一列而不是CSV。
SELECT answer, sa.exam_id, timestamp, sa.taking_id, te.source_url,
GROUP_CONCAT(DISTINCT answer)
FROM wp_watupro_student_answers as sa
INNER JOIN wp_watupro_question as q
ON sa.question_id = q.ID
INNER JOIN wp_watupro_taken_exams te
ON te.ID = sa.taking_id
GROUP BY sa.taking_id;
感谢任何帮助。
--- ---编辑
数据和预期产出如下: