业务要求:把表table_1的column1字段值相同的记录挨着,然后还要按count(column1)降序排列。例如 id ,column1 1 a 2 a 3 a 4 b 5 b 6 c
count(column1)的值分别是3,2,1这样排序,然后还要把每条记录都显示出来 请问如何面相对象的设计HQL 开始用SQL写出了雏形, 如下是HQL select b from (select t.column1,count(t.column1) cout from table_1 t group by t.column1) a, table_1 b where a.column1= b.column1 order by a.cout desc 转到HQL后,执行出错
id ,column1
1 a
2 a
3 a
4 b
5 b
6 c
请问如何面相对象的设计HQL
开始用SQL写出了雏形,
如下是HQL
select b from (select t.column1,count(t.column1) cout from table_1 t group by t.column1) a, table_1 b where a.column1= b.column1 order by a.cout desc
转到HQL后,执行出错