I feel as if this should be quite easy, but can\'t seem to find a solution. Suppose I have the following table:
|--------||---||---||---||---||---||---||---|
This is very weird assignment but:
http://sqlfiddle.com/#!9/2e7aa/3
SELECT SUM((q1='1')+(q2='1')+(q3='1')+(q4='1')+(q5='1')+(q6='1')+(q7='1')) FROM table WHERE Company = 'abc' AND '1' IN (q1,q2,q3,q4,q5,q6,q7)