很搞笑的在打麻将 2021-08-23 16:30 采纳率: 33.3%
浏览 45

cassandraTemplate 执行sql语句不能同时使用in 和 order by

在业务上我们要做一个根据markId分组并且按照collect_time 拿到最后一条数据
cassandraTemplate 执行sql

select mark_id, collect_time from temp_his where mark_id in (1,2,3) group by mark_id order by collect_time desc

提示报错
Cannot page queries with both ORDER BY and a IN restriction on the partition key; you must either remove the ORDER BY or the IN and sort client side, or disable paging for this query; nested exception is com.datastax.driver.core.exceptions.InvalidQueryException: Cannot page queries with both ORDER BY and a IN restriction on the partition key; you must either remove the ORDER BY or the IN and sort client side, or disable paging for this query

提示不能同时使用in 和 order by

  • 写回答

2条回答 默认 最新

  • CSDN专家-sinJack 2021-08-23 16:39
    关注

    无法对分区键同时使用ORDER BY和IN限制进行分页查询;您必须删除ORDER BY或IN并对客户端进行排序,或禁用此查询的分页;嵌套异常是com.datastax.driver.core.exceptions.InvalidQueryException:不能在分区键上同时使用ORDER BY和IN限制分页查询;您必须删除ORDER BY或IN并对客户端进行排序,或者禁用此查询的分页
    in 和 order by一起使用是肯定没问题的,只是你使用过程中违背了规则。

    评论

报告相同问题?

问题事件

  • 修改了问题 8月24日
  • 修改了问题 8月23日
  • 修改了问题 8月23日
  • 创建了问题 8月23日

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b