select f.name from
(select count(*) count,t.* from T t group by t.name) f order by f.count
但是HQL试了半天也没试出来,郁闷极点
...全文
1357打赏收藏
求一有难度的HQL
一个表 T namelover al1 al2 al3 bl4 cl5 cl6 按lover个数的多少返回name ,上表应该返回 a c b 即:先统计各数,再排序返回。 对应的SQL为: select f.name from (select count(*) count,t.* from T t group by t.name) f order by f.count 但是HQL试了半天也没试出来,郁闷极点