How to use CASE expression in OQL SELECT

I'm trying to return a conditional expression within the SELECT part of an OQL statement: SELECT (...) COUNT(ReplyUnread.Content) as RepliesUnread, CASE RepliesUnread WHEN '0' THEN 'noUnread' ELSE 'hasUnread' (...)   However, the query cannot be parsed, without any clear error description. How should I use the case statement?
1 answers

Okay, I found it myself using some SQL documentation which is apparently more correct than the Mendix OQL documentation

There should be an 'END' after the statement:

CASE COUNT(ReplyUnread.Content) WHEN 0 THEN 'noUnread' ELSE 'hasUnread' END