SqlServer 视图中使用Order by

在sql中,若是在一个子视图语句中,使用排序查询

视图:

select xx from TableName order by XX

查询:

select xx from
 (
  select xx from TableName order by XX
 )S

这时候,系统中可能报错


这时,我们要给 视图查询的子句,增添 TOP (100) PERCENT

select xx from
 (
  select TOP (100) PERCENT xx from TableName order by XX
 )S


猜你喜欢

转载自blog.csdn.net/ZYD45/article/details/80747991
今日推荐