首页 新闻 会员 周边 捐助

SQL求解 ,谢谢!

0
悬赏园豆:20 [已解决问题] 解决于 2010-08-12 08:50

SQL语句如下:
select top 10 * from
( select ROW_NUMBER() OVER (order by ID) as RowNum,* from config_ProdClsSet where SetType ='1' and UserType= '1' and [Enabled]='1' order by OrderIndex
) as C
where RowNum > ((1 - 1) * 10)

报以下错误:
除非另外还指定了 TOP 或 FOR XML,否则,ORDER BY 子句在视图、内联函数、派生表、子查询和公用表表达式中无效。

请各位帮忙解决,谢谢!

期星揽月的主页 期星揽月 | 初学一级 | 园豆:22
提问于:2010-08-11 18:01
< >
分享
最佳答案
0

 select ROW_NUMBER() OVER (order by ID) as RowNum,* from config_ProdClsSet where SetType ='1' and UserType= '1' and [Enabled]='1' order by OrderIndex
把这个建成一个视图,再查询这个视图就OK了

收获园豆:15
浪子秋水 | 菜鸟二级 |园豆:254 | 2010-08-11 20:19
其他回答(1)
0

select top 10 * from
(
select ROW_NUMBER() OVER (order by ID) as RowNum,* from config_ProdClsSet where SetType ='1' and UserType= '1' and [Enabled]='1'
)
as C
where RowNum > 0
order by OrderIndex

 

收获园豆:5
邀月 | 园豆:25475 (高人七级) | 2010-08-11 19:25
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册