日期:2014-05-17  浏览次数:20531 次

select 、distinct、order by的执行顺序
select 、distinct、order by的执行顺序

标准的应该是先select,然后distinct,再order by

我这边有点疑问,既然已经执行了select,列已经选出来了,为什么下面的代码是对的

select id from test order by name

order by执行顺序应该在select之前吗?

------解决方案--------------------
order by 是针对表列的,与是否为查询列好像无关吧.