HQL оператор выбора с регистром - PullRequest
0 голосов
/ 20 марта 2020

Возможно ли добавить оператор "Case" внутри другого "Case"? Это не работает по-моему.

"case when (cia.nif is not null then cia.nif else case when(d.owner then c2.cif else '')) as cia_externa_nif, " +

Может кто-нибудь помочь мне? Спасибо!

1 Ответ

0 голосов
/ 20 марта 2020

Вот пример

select
    order_id,
    max(timestamp),
    case when max(case when action = 'D' then timestamp end) is not null then 1 else 0 end myAlias
from ORDER
group by order_id
...