看看我的HQL怎么写?
select u.Id
from User u inner join u.CheckList as c
group by u
having max(c.CheckDate) between :date1 and :date2
我想要输出的是u而不是u.Id.但如果改为"select u"运行时会出现生成的sql语句错误.
------最佳解决方案--------------------你是在程序中写还是在数据库中写?如果是在程序中
select u.* from User u inner join u.CheckList as c
group by u
having max(c.CheckDate) between :date1 and :date2
你可以这么试试