当我执行:
SELECT t.testname , r.testrange
FROM test as t
LEFT JOIN range r ON t.test_id = r.test_id
WHERE r.test_id = 25;
我得到如下结果:-
+-----------+---------------------+
| testname | testrange |
+-----------+---------------------+
| A:G RATIO | 15-20 for children |
| A:G RATIO | 30-60 for adults |
| A:G RATIO | 100 - 200 for women |
+-----------+---------------------+
如您所见, testname 在第一列中重复。那么我怎么能得到这样的结果 -
+-----------+---------------------+
| testname | testrange |
+-----------+---------------------+
| A:G RATIO | 15-20 for children |
| -- | 30-60 for adults |
| -- | 100 - 200 for women |
+-----------+---------------------+
即只有唯一的 testname 应该与 testrange 列中的所有 testrange 一起出现在 testname 列中。