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 test(
dealer varchar(2) ,
desktop int,
tablet int );

insert into test values
('A',1,0),
('A',1,0),
('B',0,1),
('C',0,0),
('A',0,1),
('A',1,0),
('C',0,1),
('C',0,0),
('C',0,0),
('B',0,1),
('B',0,0),
('B',0,0),
('A',0,0);





select dealer,
COALESCE(SUM(case when desktop = 0 and tablet = 0 then 1 end),0) as laptop,
COALESCE(SUM(case when desktop = 1 then 1 end),0) as desktop,
COALESCE(SUM(case when tablet = 1 then 1 end),0) as tablet
from test
group by dealer;
dealer laptop desktop tablet
A 1 3 1
B 2 0 2
C 3 0 1