qq_26373023 2016-03-31 04:00 采纳率: 9.1%
浏览 1339
已结题

关于hql语句查询的问题

select information,count(information) from Information information where 1=1 group by information.id;
请问这hql语句合法么,Information是个视图,同时也有这个实体类~想查询出这个information对象,并且算出个数

  • 写回答

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()

    评论

报告相同问题?

悬赏问题

  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退