我必须针对该条目检查null
。
我有个人对象的地址,所以我试着像下面一样抓取它。
select new map(person.id as id,
case when person.address is not empty
then person.address.city end as city)
from Person person where person.id=:id
case..when
是否适用于where
子句
但没有错误和结果。
答案 0 :(得分:0)
试试这个:
select new map(person.id as id,coalesce(person.address,person.address.city )as city) from Person person