3
我有以下查詢:在休眠「情況下......然後......其他......結束」時可以使用「和」?
select myentity from TEST as test
left join test.org.parent as parentOrg
left join test.clientRequest as clientReq
where test.customId = 1 and (test.dstatus = 1 or test.cm = true)
order by (case when test.request != '' then test.request else clientReq.name end) asc;
它正常工作。但我不僅需要clientReq.name
,還需要clientReq.surname
。在這個case when...then...else...end
中可以組合這兩列嗎?
喜歡的東西:
order by (case when test.request != '' then test.request else (clientReq.name and clientReq.surname) end) asc;
這一次拋出異常:
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node
你的意思是字符串連接(即姓+名)還是邏輯AND? –
@PeterBratton,我的意思是串聯,但順便說一句,有可能使用邏輯AND? – Dragon