我正在尝试通过SQL解决我遇到的一些问题但是目前,没有任何成功,我有一个历史玩家VIP级别表,看起来像这样:
+----------+----------+----------+-------+--+
| PlayerID | OldLevel | NewLevel | Date | |
+----------+----------+----------+-------+--+
| 747 | Entry | Bronze | 03-17 | |
| 747 | Bronze | Silver | 04-17 | |
| 123 | Entry | Bronze | 03-17 | |
| 123 | Bronze | Silver | 04-17 | |
| 123 | Silver | Gold | 06-17 | |
+----------+----------+----------+-------+--+
OldVip =播放器VIP级别更改日期(日期列)
之前NewVIP =玩家VIP级别更改日期(日期列)
我想创建一个将创建以下输出的查询:
+---------+-------+-------+--------+--------+--------+--------+--------+--------+--+
| ID/Date | 01-17 | 02-17 | 03-17 | 04-17 | 05-17 | 06-17 | 07-17 | 08-17 | |
+---------+-------+-------+--------+--------+--------+--------+--------+--------+--+
| 747 | Entry | Entry | Bronze | Silver | Silver | Silver | Silver | Silver | |
| 123 | Entry | Entry | Bronze | Silver | Silver | Gold | Gold | Gold | |
+---------+-------+-------+--------+--------+--------+--------+--------+--------+--+
试图在SELECT语句中使用Cases但没有得到所需的结果。
感谢任何帮助。