select information,count(information) from Information information where 1=1 group by information.id;
请问这hql语句合法么,Information是个视图,同时也有这个实体类~想查询出这个information对象,并且算出个数
关于hql语句查询的问题
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
3条回答
聪明的一休丶 2016-03-31 04:33关注select information,count(information) from Information information where 1=1 group by information.id;问题很多
直接select * from information; 条数就是 结果集的大小.size();
然后说你的语法问题:
select information,count(information) from Information information 。。。。。这句话问题很多仔细看
where 1=1 group by information.id;后半句 where 1=1;有必要么? group by不应该这么用
information.id这样的结果是唯一的,而且应该在 where后面 。。。。
单独查询条数可以用 select count(information) from Information;
查询所有用 select * from Information ;返回的是List ,,,个数就是 size()解决 无用评论 打赏 举报