争求一个复杂的存储过程或SQL语句,高手帮忙啊
flight effectdate subclass
------- ------------------------------------------------------ --------
va1235 2007-04-18 00:00:00.000 a
va1235 2007-04-18 00:00:00.000 d
va1235 2007-04-18 00:00:00.000 f
va1235 2007-04-18 00:00:00.000 e
va1235 2007-04-18 00:00:00.000 v
va1235 2007-04-19 00:00:00.000 c
va1235 2007-04-19 00:00:00.000 d
va1235 2007-04-19 00:00:00.000 f
.......
对同一flight进行按日期的归并,如下
转成
flight effectdate a d f e v c
va1235 2007-4-18 T T T T T NULL
va1235 2007-4-19 null T T null null T
.....
------解决方案--------------------需要通过临时表实现
------解决方案--------------------subclass固定的话可以这样写
select flight,
effectdate,
max(case when subclass= 'a ' then 'T ' end) as a,
max(case when