How to convert horizontal string to vertical SQL Server
Query:
Select
COUNT(aciklama)as Permitted,
(Select COUNT(aciklama)
from Uyari
where Aciklama like '%Blocked%') as Blocked
From
Uyari
where
Aciklama like '%Permitted%'
Output:
Permitted Blocked
----------------------
74 9194
I want to get the result like this:
Permitted ... 74
Blocked ... 9194
Can anyone please help?
+3
Mohamed mohamed
source
to share
1 answer
Here's one parameter using 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%'
+2
sgeddes
source
to share