select SUBSTRING_INDEX(group_concat(b.id order by b.credate desc),',',1) from Table as b
where b.IdentityID is not null group by b.IdentityIDmysql里没问题,在hibernate中报错org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: order near line 1,
hibernate把sql都封装了 楼上正解