OQL query COUNT CASE

0
Hey I have a OQL query whitch need to count a value based on a string. now I have the next query but it gives error. SELECT     COUNT(CASE WHEN  Check.Result = 'OK' THEN 1 END) as  OK the error: Caused by: java.sql.SQLSyntaxErrorException: data type cast needed for parameter or null literal in statement
asked
2 answers
1

Have you tested this query in regular SQL context if it works and if it returns what you expect of? Maybe you should think about adding a subquery to your sql request.

answered
0

Correct syntax should by like:

select 
  case when Result = 'OK'   then count(Result) end as CountResult
from ...
group by Result

answered