M.Nagendra - 7 months ago 56

MySQL Question

`where '0' NOT IN (I_DET_FACTOR1, I_DET_PERC1, I_DET_FACTOR2, I_DET_PERC2, I_DET_FACTOR3, I_DET_PERC3)`

I am using this query any one zero than hide total row .but my requirement is all are zero than only hide total row

Answer

To hide row when **any** column is zero (show row when **all** columns are **not** zero)

```
WHERE
I_DET_FACTOR1 <> '0'
AND I_DET_PERC1 <> '0'
AND I_DET_FACTOR2 <> '0'
AND I_DET_PERC2 <> '0'
AND I_DET_FACTOR3 <> '0'
AND I_DET_PERC3 <> '0'
```

To hide row when **all** columns are zero (show row when **any** column is **not** zero)

```
WHERE
I_DET_FACTOR1 <> '0'
OR I_DET_PERC1 <> '0'
OR I_DET_FACTOR2 <> '0'
OR I_DET_PERC2 <> '0'
OR I_DET_FACTOR3 <> '0'
OR I_DET_PERC3 <> '0'
```