3
I have a select that returns the average of the columns. I used Round to remove a few decimal places and round the numbers.
The possible numbers of the fields are integers from 1 to 5, and when doing the average select the decimals appear. But my need is for these decimals to be rounded to 0.5 intervals. Example: 1.0, 1.5, 2.0, 2.5, 3.0 etc
My select is this:
SELECT
nomNome,
ROUND(((notaAmbiente +
notaApresentacaoDasPizzas +
notaQualidadeDosProdutos +
notaVariedadeDeSabores +
notaAtendimentoNaLoja +
notaAtendimentoNoTel +
notaAgilidadeNaEntrega +
notaCustoBeneficio +
notaPromocoes +
notaSite +
notaSatisfacao + notaSatisfacao) / 12), 1) AS notaOpiniao
FROM tbOpiniao
As returns without the correct rounding: 3,2 (3,199) and 2,3 (2,277) How do I want you to return: 3.0 and 2.5
How to do this?
Give an example of output! type output a value has to stay that value ?
– user6026
3,1999 would not be 3,5 ?
– user6026
not because it is below the middle half 0.1999 < 0.25. From 0.25 to 0.49 round to 0.5
– Joao Paulo
So it’s not 0.5 to 0.5? look at your question?
– user6026
I made an SQL, which in my opinion is your reality, including tested.
– user6026