- SQL code
select * from (select m_filmname, m_filmurl,row_number() over(order by id desc) as num from all_movie a where a.source_id=1003 order by id desc) twhere t.num =1 between 11 and 20 order by num asc
这个为什么会报错??
消息 1033,级别 15,状态 1,第 3 行
除非另外还指定了 TOP 或 FOR XML,否则,ORDER BY 子句在视图、内联函数、派生表、子查询和公用表表达式中无效。
这个sql 在oracle里面是正确的,,,请问怎么改, ...............
------解决方案--------------------
楼主是在视图里用?
------解决方案--------------------
where t.num =1 between 11 and 20 order by num asc
-->
where t.num between 11 and 20 order by num asc
------解决方案--------------------
改为
- SQL code
select * from (select m_filmname, m_filmurl,row_number() over(order by id desc) as num from all_movie a where a.source_id=1003) twhere t.num =1 between 11 and 20 order by num asc
------解决方案--------------------
- SQL code
select * from (select m_filmname, m_filmurl,row_number() over(order by id desc) as num from all_movie a where a.source_id=1003 ) twhere t.num between 11 and 20 order by num asc
------解决方案--------------------
- SQL code
select * from ( select m_filmname, m_filmurl,row_number() over(order by id desc) as num from all_movie a where a.source_id=1003) twhere t.num between 11 and 20 order by num asc
------解决方案--------------------
- SQL code
select * from (select m_filmname, m_filmurl,row_number() over(order by id desc) as numfrom all_movie a where a.source_id=1003) twhere t.num =1 between 11 and 20 order by num asc