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 opencv 无法读取视频
  • ¥15 用matlab 实现通信仿真
  • ¥15 按键修改电子时钟,C51单片机
  • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))
  • ¥20 5037端口被adb自己占了
  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图