SSRS - 计算内容,如果是Y或1,则“A”否则为“B”

时间:2015-01-01 01:23:41

标签: sql visual-studio-2010 reporting-services

新年快乐每个人!!!

我的目标是编写一个查询以返回结果ACTIVE OR INACTIVE。 这就是我到目前为止所做的。有谁知道如何正确编写此查询?

SELECT COUNT (*) AS Active FROM ADF_Course
WHERE CourseActive=1 OR CourseActive='y'
ELSE IF CourseActive=n
THEN CourseActive IS Inactive

1 个答案:

答案 0 :(得分:0)

SELECT 
case when CourseActive='1' OR CourseActive='y' 
then 'Active' else 'Inactive' end AS Active, count(*)
FROM ADF_Course
group by
case when CourseActive='1' OR CourseActive='y' 
then 'Active' else 'Inactive' end