我正在尝试根据交叉表信息生成两列。具体来说,我试图选择在论坛中提出问题的学生,并将其放入“提问者”列,并选择回答问题的学生,并将其放入“回答者”列。查询单独工作,但是当我按如下方式通过逗号加入它们时,会出现以下语法错误:
SELECT author_id AS questioner
WHERE post_type='question',
group_concat(DISTINCT author_id SEPARATOR " ") AS answerers
WHERE post_type='answer'
FROM students;
语法错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '
group_concat(DISTINCT author_id SEPARATOR " ") AS answerers
FROM students
WHERE' at line 12
我如何获得一列提出问题的人和一列回答问题的人?我假设错误来自对 SELECT 语法的误解。