我正在尝试计算通过和失败的设备我有我想要的所有数字,但它们并不完全正确。
例如:
select
t3.displayname as [PSI],
case when t0.compliant = 0 then count(displayname) end as [failures],
case when t0.compliant = 1 then count(displayname) end as [success]
from lineitemsmap as t0
inner join art_blob as t1 on t1.art_blob_id = t0.blobid
inner join art_asset as t2 on t2.art_asset_id = t1.art_asset_id
inner join net_ou as t3 on t3.net_ouid = t2.net_ouid
group by t3.displayname, t0.compliant
生成:
------------------------------
| PSI | failures | success |
------------------------------
| 1 | 3 | NULL |
------------------------------
| 2 | 4 | NULL |
------------------------------
| 3 | 5 | NULL |
------------------------------
| 1 | NULL | 6 |
------------------------------
| 2 | NULL | 7 |
------------------------------
| 3 | NULL | 8 |
------------------------------
我试图让所有结果在 3 行第 6 节中返回。