# Select top row for each group

**URL:** <https://discourse.hibernate.org/t/select-top-row-for-each-group/1158>\
**Category:** Hibernate ORM\
**Created:** [August 2, 2018, 5:45pm UTC](https://discourse.hibernate.org/t/select-top-row-for-each-group/1158 "2018-08-02T17:45:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Koushik\_Paul](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/koushik_paul/32/211_2.png) [@Koushik\_Paul](https://discourse.hibernate.org/u/Koushik_Paul)\
**Post date:** [August 2, 2018, 5:45pm UTC](https://discourse.hibernate.org/t/select-top-row-for-each-group/1158/1 "2018-08-02T17:45:59Z")

</div>

select top row for each group

Is this possible in HQL??

Where I can receive the output in a list of the DTO class, without any cast exception

---

<div class="post-metadata">

**Author:** ![vlad](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/vlad/32/658_2.png) [@vlad](https://discourse.hibernate.org/u/vlad)\
**Post date:** [August 7, 2018, 9:04am UTC](https://discourse.hibernate.org/t/select-top-row-for-each-group/1158/2 "2018-08-07T09:04:34Z")

</div>

It’s not clear what you are asking. Try to provide an example and provide more details so we can get a better understanding of your problem.
