我有一份SSRS报告,下拉列表为活动状态,非活动状态和全部。当我选择有效和无效时,它会显示数据,但是当我选择所有'它不显示任何数据。我尝试了很多可能性,但对我没用。
这是我在主程序中的条件
WHERE
( (@Status = 'ALL') OR
(DisabledDate IS NULL AND @Status = 'ACTIVE') OR
(DisabledDate IS NOT NULL AND @Status = 'INACTIVE')
)
我的参数查询是
SELECT 'ALL' AS Status
UNION ALL
SELECT DISTINCT (case when DisabledDate IS NULL then 'ACTIVE' else 'INACTIVE' END) AS Status
FROM Table
答案 0 :(得分:0)
改变你的,
参数查询:
SELECT 'ALL' AS STATUS
UNION ALL
SELECT 'ACTIVE' AS STATUS
UNION ALL
SELECT 'INACTIVE' AS STATUS
其中主要程序中的条件为:
WHERE
@Status =
COALESCE(
CASE WHEN STATUS = 'ALL' THEN 'ALL' END,
CASE WHEN STATUS = 'ACTIVE' THEN 'ACTIVE' END
CASE WHEN STATUS = 'INACTIVE' THEN 'INACTIVE' END
)