Fix with select using sum within case

Asked

Viewed 24 times

0

I’m trying to use the code below:

select
case when((sum(valido) / sum(total) * 100) >= 60 then 60 else (sum(valido) / sum(total) * 100) end) i1
from tabela

Syntax error near 'then 60 Else...'

  • I don’t understand, what is the doubt?

  • hi buddy, sorry. I made the post change @Ricardopunctual

  • Don’t have to end with END CASE? https://dev.mysql.com/doc/refman/8.0/en/case.html

  • @Leonardoalvesmachado no. the error is in the calculation. by the looks of it I will create Queries to make the code I need.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.