mybatis中distinct和order by 的用法(同时使用)
1:帖一段sql在mybatis的代码select distinct student_idfromt_student order by creat_time desc这段代码在数据库中是不会报错的,但是你开启服务后会报xml错误。解决办法是,order by的字段要在distinct中存在 即:select distinct student_id ,creat_time fromt_student
·
1:帖一段sql在mybatis的代码
select distinct student_id from t_student order by creat_time desc
这段代码在数据库中是不会报错的,但是你开启服务后会报xml错误。
解决办法是,order by的字段要在distinct中
存在 即:
select distinct student_id ,creat_time from t_student order by creat_time desc
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)