来自如下所示的数据(在 MySQL 数据库中):
mysql> select * from test;
+------------+--------+
| start | name |
+------------+--------+
| 2013-04-01 | Donald |
| 2013-04-02 | Daisy |
| 2013-04-03 | Mickey |
| 2013-04-03 | Minnie |
| 2013-04-01 | Pluto |
| 2013-04-02 | Goofy |
+------------+--------+
6 rows in set (0.00 sec)
我想编写一个查询来生成如下所示的输出:
2013-04-01 2013-04-02 2013-04003
---------- ---------- ----------
Donald Daisy Mickey
Pluto Goofy Minnie
有人可以建议 SQL 查询来产生这个输出吗?
如果有帮助,这是我用来创建示例数据的代码。
create table test (
start date,
name varchar (20));
insert into test values ('2013-04-01','Donald');
insert into test values ('2013-04-02','Daisy');
insert into test values ('2013-04-03','Mickey');
insert into test values ('2013-04-03','Minnie');
insert into test values ('2013-04-01','Pluto');
insert into test values ('2013-04-02','Goofy');`