Использование суммы условного агрегирования (случай, когда ...
drop table if exists t;
create table t
(Sno int, Product varchar(10), Qty1 int, Qty2 int, Qty3 int);
insert into t values
(1 , 'Soap' , 1 , 0 , 1),
(2 , 'Ball' , 1 , 1 , 0),
(3 , 'Deodrant' , 0 , 0 , 0),
(4 , 'Butter' , 1 , 0 , 1);
select
sum(Qty1 + Qty2 + Qty3) total_ones,
sum(case when Qty1 = 1 or Qty2 = 1 or Qty3 = 1 then 1 else 0 end) total_rows_with_ones
from t ;
+------------+----------------------+
| total_ones | total_rows_with_ones |
+------------+----------------------+
| 6 | 3 |
+------------+----------------------+
1 row in set (0.001 sec)