spring中@query()注解中的sql查询出现意外的令牌异常

ebdffaop  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(139)

我在里面使用了一个很长的sql查询字符串 @Query() Spring的注解。我得到了多个令牌的异常。有人能提供以下查询的解决方案吗:

@Query("select p, top5.duration_seconds / 60 as duration_minutes, top5.max_seconds / 60 as max_minutes " +
            "from (select r.driver_id, "+
         "sum(to_seconds(r.end_time) - to_seconds(r.start_time)) as duration_seconds, "+
         "max(to_seconds(r.end_time) - to_seconds(r.start_time)) as max_seconds "+
         "from ride r "+
         "where r.start_time >= '2018-08-08T12:12:12'  and "+
         "r.end_time <= '2018-08-08T18:12:12' "+
         "group by r.driver_id "+
         "order by duration_seconds desc "+
         "limit 5 "+
         ") top5 join "+
         "person p "+
         "on top5.driver_id = p.id")

它显示了
意外:总和
antlr.noviablealtexception:意外标记:(
antlr.missmatchedtokenexception:应为eof,找到')'

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题