Chinaunix

标题: sql语句加distinct以后,返回结果的顺序就变了 [打印本页]

作者: neil_young    时间: 2006-03-03 10:34
标题: sql语句加distinct以后,返回结果的顺序就变了
select f1,f2 from table1 order by f2,f3
加上distinct
select distinct f1,f2 from table1 order by f2,f3

因为f3这个字段不在distinct里面,按f3排序居然就出了问题。我把F3加到distinct里面就解决了。

可把我害苦了,大家有碰到过这样的问题吗,有谁能解释这里头的过程吗?
作者: neil_young    时间: 2006-03-07 09:05
不会吧,居然没有人碰到过,没有人知道?
作者: lunchan    时间: 2006-03-07 10:13
那不单是顺序的问题吧,因为需要的内容也没有给选出来




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2