我对命名查询的排序结果有疑问,例如:
@Query("select s from Survey s where s.interviewer = :interviewer order by substring(s.respondent, 2, length(s.respondent) - 1))")
List<Survey> getByWorkModeAndInterviewerOrderByRespondentSurnameAsc(@Param("interviewer") String interviewer, Pageable pageable);
此代码有效并且命令结果升序。
@Query("select s from Survey s where s.interviewer = :interviewer order by substring(s.respondent, 2, length(s.respondent) - 1)) DESC")
List<Survey> getByWorkModeAndInterviewerOrderByRespondentSurnameDesc(@Param("interviewer") String interviewer, Pageable pageable);
此代码也有效,但不是按顺序排序,而是按升序排序。
我做错了什么?