可以说我有一个具有两列firstname和lastnameString数据类型的表。通常我写我的hql查询像
firstname
lastname
"select firstname,lastname from contact"
我可以编写将两个属性都连接在一起的hql查询吗?
也许像 "select firstname+lastname as fullname from Contact"
"select firstname+lastname as fullname from Contact"
select concat(c.firstname, c.lastname) as fullname from Contact c
或者,如果您想要分隔符:
select concat(c.firstname, ' ', c.lastname) as fullname from Contact c
请参阅文档。