3列中的SSRS 5列

时间:2016-03-20 12:17:39

标签: sql reporting-services

我有3列:

Date    Type    Item
1/1/2015   A      X
3/2/2015   B      X
1/6/2015   A      Y
3/7/2015   B      Y

我想用表格显示表格:

DateA Type DateB Type Item
1/1/2015 A 3/2/2015 B X
1/6/2015 A 3/7/2015 B Y

我该怎么做?

1 个答案:

答案 0 :(得分:0)

这看起来像条件​​聚合:

select max(case when type = 'A' then date end) as DateA, 'A' as TypeA,
       max(case when type = 'B' then date end) as DateB, 'B' as TypeB
       item
from t
group by item;