create table test (id int, c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int);
insert into test values
(1, 1, 1, 1, 1, 1, 1, 1),
(2, 1, 1, 1, 1, 1, 1, 0),
(3, 1, 1, 1, 1, 1, 1, 2),
(4, 1, 0, 1, 1, 1, 0, 1);
SELECT id, (c1=1) + (c2=0) + (c3=1) + (c4=1) + (c5=1) + (c6=1) + (c7=1) FROM test
WHERE ((c1=1) + (c2=0) + (c3=1) + (c4=1) + (c5=1) + (c6=1) + (c7=1)) = 6
;