I have the following query:
SELECT
ROUND((( notaAmbiente +
notaApresentacaoDasPizzas +
notaQualidadeDosProdutos +
notaVariedadeDeSabores +
notaAtendimentoNaLoja +
notaAtendimentoNoTel +
notaAgilidadeNaEntrega +
notaCustoBeneficio +
notaPromocoes +
notaSite +
notaSatisfacao + notaSatisfacao) / 12) / 0.5, 0) * 0.5 AS mediaNotaOpiniao
FROM tbOpiniao
In this query I take the notes for each type of evaluation, sum and divide to get the average. However, in the middle of these notes there may be a value of 0 (referring to "I can not tell" when filling in the form that you register in the bank), so I can not use this value in the division, as it will affect the evaluation in a wrong way.
What I would like to do is to remove the column from the split account when its value is 0, subtracting 1 from the value 12, which is the number of columns I use to average.
I thought I'd put 12 something like SELECT COUNT (*) WHERE column , but there are other columns besides those in the table.