我正在做以下查询
SELECT
p.id
,q.name
,pa.result
FROM
postulant_answers as pa
LEFT OUTER JOIN postulants as p ON (p.id = pa.postulant_id)
LEFT OUTER JOIN questions as q ON (q.id = pa.question_id);
这向我展示了以下结果:
+------+--------------+--------+
| id | name | result |
+------+--------------+--------+
| 9 | Question 1 | 15 |
| 9 | Question 2 | 70 |
| 9 | Question 3 | 75 |
| 591 | Question 1 | 15 |
| 591 | Question 2 | 70 |
| 591 | Question 3 | 75 |
但我需要更多类似的东西:
+------+------------+------------+------------+
| id | Question 1 | Question 2 | Question 3 |
+------+------------+------------+------------+
| 9 | 15 | 70 | 75 |
| 591 | 15 | 70 | 75 |
我可以在一个查询中做到这一点吗?
任何帮助,将不胜感激