MySQL社区

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
查看: 1347|回复: 2
打印 上一主题 下一主题

[Java相关] 求大神帮忙看下 not exists 和 order by 结合无法排序

[复制链接]
跳转到指定楼层
1#
发表于 2016-7-6 18:19:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  1. select stuId,stuName from student student  where  campusId=1 and  stuAdvisor=108 and   not exists  (select stuId from stu_class stu_Class where classId=515 and student.stuId=stu_Class.stuId)  order by stuName  limit 0,10
复制代码
not exists 和order by 结合,查询结果没有按照 stuName排序,请大神指教下,拜谢
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 分享淘帖 顶 踩
2#
发表于 2016-8-3 17:57:25 | 只看该作者
你的 order by 后面没有加排序的类型:asc或者desc

参考自:
MySQL如何优化ORDER BY http://www.data.5helpyou.com/article246.html
3#
发表于 2016-9-8 11:10:47 | 只看该作者
首先是升序的,sql语句是没有问题的,你可以先在数据库里面查询
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|申请友链|小黑屋|Archiver|手机版|MySQL社区 ( 京ICP备07012489号   
联系人:周生; 联系电话:13911732319

GMT+8, 2024-4-20 00:25 , Processed in 0.081841 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表