这条SQL语句为何会有问题呢??
select ROW_NUMBER() OVER (ORDER BY 创建人 desc) as '序号',* from (select .................) as xxx wehre 序号=1 order by 序号 desc
现在报 序号列无效 但是如果去掉"where 序号=1" 就可以正常。。 那么order by 序号 desc 也用到了序号列为何没事呢?奇怪了?
------解决方案----------------------还不如一句
Select top 1 * from tb order by 创建人 desc
--或者改为
Select * from ( select ROW_NUMBER() OVER (ORDER BY 创建人 desc) as '序号 ',*
from (select .................) as xxx) t wehre 序号=1 order by 序号 desc