HQL: How to select all entities distinct by some column?

后端 未结 7 1283
被撕碎了的回忆
被撕碎了的回忆 2020-12-14 08:20



A simple question:
In this example I need to retrieve all objects, but these objects must have distinct msgFrom fields.
When I use

List&         


        
7条回答
  •  再見小時候
    2020-12-14 08:37

    Try this, it worked for me:

    SELECT FROM YourTableName 
    WHERE somecolumnName=condition 
    GROUP BY yourDistinctColumnName
    

提交回复
热议问题