你可以把你这个表再给描述的清楚点么?进度数量是什么是五种商品的各自的总数量么?
select (select count(*) from table where kind=a)as a,
(select count(*) from table where kind=b)as b,
(select count(*) from table where kind=c)as c,
(select count(*) from table where kind=d)as d,
(select count(*) from table where kind=e)as e
from table
部分代码:
String hql="select * from table where ……";
List list=query.list();
int count=(Integer)list.get(0);//总记录数
==========补充
不好意思,写错了 是select count(*) from table where ……"; 绝对是不能String hql="select * from table where ……";这么写的,这么写就是吧整张表的数据放入query中,像你几十万条数据马上就内存溢出