查询:

Select
    COUNT(aciklama)as Permitted,
    (Select COUNT(aciklama)
     from Uyari
     where Aciklama like '%Blocked%') as Blocked
From
    Uyari
where
    Aciklama like '%Permitted%'

输出:
Permitted     Blocked
----------------------
    74         9194

我想要这样的结果:
Permitted   ...      74
Blocked    ...     9194

有谁可以帮忙吗?

最佳答案

这是一个使用union all的选项

select 'Permitted' action, COUNT(aciklama) as result
from Uyari
where Aciklama like '%Permitted%'
union all
select 'Blocked' action, COUNT(aciklama)
from Uyari
where Aciklama like '%Blocked%'

09-30 00:04