Skip to content
Advertisement

Case When syntax expression in jooq

I am trying to reproduce this MySQL query in jooq

to

Advertisement

Answer

What you seem to be looking for is the SQL:2003 simple CASE expression, which allows to form something like “partial predicates” based on the case value, akin to pattern matching in other languages. This is not yet supported in jOOQ, see Issue #3223.

Interestingly, though, your SQL example doesn’t use this syntax, nor does it correspond to your suggested jOOQ API usage. I suspect you wanted to use this syntax to avoid repeating the subtraction twice. This could be done also as follows, in SQL:

This would translate to:

This static import is implied:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement