ARAVINDH GOPI - 6 months ago 45

MySQL Question

Answer

Sorry for the inconvienience, my question is "how to count field values of multiple rows". I got my answer below

```
select (sum(case when m1 = 6 then 1 else 0 end) +
sum(case when m2 = 6 then 1 else 0 end) +
sum(case when m3 = 6 then 1 else 0 end) +
sum(case when m4 = 6 then 1 else 0 end) +
sum(case when m5 = 6 then 1 else 0 end)) as abc from table where staff_name='sivakumar';
```

Source (Stackoverflow)