SQL查询SSRS报告

时间:2018-09-25 03:29:51

标签: sql pivot

BUCKET1 BUCKET2 BUCKET3 BUCKET4 BUCKET5
-----------------------------------------------
NULL    NULL    10513261.05316  NULL    NULL
63609954.28567  NULL    NULL    NULL    NULL
NULL    NULL    NULL    7126516.29877   NULL
NULL    NULL    NULL    NULL    11141469.82504
NULL    19493498.33978  NULL    NULL    NULL

我有上面的桌子。我想选择所有记录,但不包括NULL记录,如下所示。

BUCKET1          BUCKET2         BUCKET3       BUCKET4         BUCKET5
------------------------------------------------------------------------------
63609954.28567   10513261.05316  7126516.29877 11141469.82504  19493498.33978

1 个答案:

答案 0 :(得分:0)

使用最大/最小聚合,如下所示:

select max(BUCKET1) as bucket1,max(BUCKET2) as bucket2,max(BUCKET3) as bucket3,max(BUCKET4) as bucket4,max(BUCKET5) as bucket5
from tablenmae