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 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面
  • ¥50 NT4.0系统 STOP:0X0000007B
  • ¥15 想问一下stata17中这段代码哪里有问题呀
  • ¥15 flink cdc无法实时同步mysql数据
  • ¥100 有人会搭建GPT-J-6B框架吗?有偿