我有一个产生下表的SQL查询:
+----------------------+-------+------+------+-----+------+
| PAYCODE | HOURS | COST | FROM | TO | ROLE |
+----------------------+-------+------+------+-----+------+
| EU All Paid Time | 5 | 66.5 | 583 | 471 | ASSC |
| DE Basic P | 5 | 66.5 | 583 | 471 | ASSC |
| EU All Hours Average | 4 | 53.2 | 583 | 470 | ASSC |
| EU All Hours Average | 5 | 66.5 | 583 | 471 | ASSC |
| EU All Worked TIme | 5 | 66.5 | 583 | 471 | ASSC |
| DE Basic P | 4 | 53.2 | 583 | 470 | ASSC |
| EU All Paid Time | 4 | 53.2 | 583 | 470 | ASSC |
| EU All Regular | 4 | 53.2 | 583 | 470 | ASSC |
| EU All Regular | 5 | 66.5 | 583 | 471 | ASSC |
| EU All Worked TIme | 4 | 53.2 | 583 | 470 | ASSC |
+----------------------+-------+------+------+-----+------+
我想更改其外观,以便在左侧保留“发件人”,“收件人”和“角色”列,然后在列标题下的支付代码名称与下面的小时,然后在另一列中显示支付代码名称的其他列费用下方的列标题
这怎么办?我设法使用PIVOT制作了单独的小时/费用表,但希望使用我描述的组合视图。
IT值得注意的是,付款代码列表会根据所赚取的收入而有所不同,因此我不想使用标准的支点来固定姓名