我在Case语句中使用多个And时遇到问题.
我的数据库看起来像:
Enrollment Paperless Validated
0 1 0
1 0 1
0 1 0
1 1 1
0 0 0
0 1 0
0 0 0
0 1 0
1 1 1
0 1 0
Run Code Online (Sandbox Code Playgroud)
所以我的查询看起来像这样:
Select
Count(case when [Enrollment] = 1 and [Paperless] = 1 and [Validated] = 1 then 1 else 0 end) as [Paperless]
,Count(case when [Enrollment] = 1 and [Paperless] = 1 and [Validated] = 1 then 1 else 0 end) as …Run Code Online (Sandbox Code Playgroud)