29584697 发表于 2016-7-6 18:19:48

求大神帮忙看下 not exists 和 order by 结合无法排序

select stuId,stuName from student studentwherecampusId=1 andstuAdvisor=108 and   not exists(select stuId from stu_class stu_Class where classId=515 and student.stuId=stu_Class.stuId)order by stuNamelimit 0,10 not exists 和order by 结合,查询结果没有按照 stuName排序,请大神指教下,拜谢

yflower 发表于 2016-8-3 17:57:25

你的 order by 后面没有加排序的类型:asc或者desc

参考自:
MySQL如何优化ORDER BY http://www.data.5helpyou.com/article246.html

pztx1992 发表于 2016-9-8 11:10:47

首先是升序的,sql语句是没有问题的,你可以先在数据库里面查询
页: [1]
查看完整版本: 求大神帮忙看下 not exists 和 order by 结合无法排序