add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE mytable (
id int,
risk varchar(20),
record varchar(20),
api varchar(20)
);

insert into mytable values
(1, 'OK', 'OK' ,'NO'),
(2, 'OK', 'OK' ,'OK'),
(3, 'OK', 'OK' ,'OK'),
(4, 'OK', 'NO' ,'OK'),
(5, 'NO', 'OK' ,'NO');
Records: 5  Duplicates: 0  Warnings: 0
select 'risk' as nm_test,
count(case when risk = 'OK' then 1 end) as 'OK',
count(case when risk = 'NO' then 1 end) as 'NO'
from mytable
union all
select 'record',
count(case when record = 'OK' then 1 end),
count(case when record = 'NO' then 1 end)
from mytable
union all
select 'api',
count(case when api = 'OK' then 1 end),
count(case when api = 'NO' then 1 end)
from mytable
nm_test OK NO
risk 4 1
record 4 1
api 3 2