0
我想在hql中進行此查詢,所以我不必將查詢結果映射到我的java對象,但嘗試不同的選項後,我仍然無法這行得通。有沒有可能以任何方式在hql中執行此查詢?查詢是:如何將sql轉換爲hql加入和最大
select t.*
from part_movement t
join
(select id_block_movement, max(start_date) as somedate
from part_movement
where id_area_final_destination = 1
and ((id_area_destination != id_area_final_destination and id_user_receiver is not null) or
(id_area_destination = id_area_final_destination and id_user_receiver is null))
group by id_block_movement
) s
on s.id_block_movement = t.id_block_movement
and s.somedate= t.start_date;
感謝高級!