这是我的桌子Appel
+------+--------+-------+
| Name | Sports | Date |
+------+--------+-------+
| Clem | Foot | 08feb |
| Clem | Foot | 15feb |
| Clem | Ping | 21feb |
| Caro | Ping | 08feb |
| Caro | Ping | 15feb |
| Caro | Ping | 21feb |
| Flo | Foot | 21feb |
+------+--------+-------+
我想得到一个这样的表(按日期组织):
+------+---------+---------+---------+
| Name | 08feb | 15feb | 21feb |
+------+---------+---------+---------+
| Cle | Foot | Foot | Ping |
| Cyro | / | / | Foot |
| Flo | Ping | Ping | Ping |
+------+---------+---------+---------+
我的想法是:
SELECT Name, 08feb, 15feb, 21feb FROM Appel ORDER BY Name ASC
。
但是我有2个问题:
=>如何动态选择列名?
=>如何用“ /”或其他内容替换空数据。