运行此语句时,我收到错误Windowed functions and NEXT VALUE FOR functions do not support constants as ORDER BY clause expressions.
SELECT * FROM (select ROW_NUMBER() OVER (ORDER BY 'publishdate DESC') as RowNum,
* FROM news WHERE publishdate <=getdate()) as info
WHERE RowNum > 0 AND RowNum <= (100)
我想使用此语句在分页网格视图中检索结果集。
如何运行此语句?
答案 0 :(得分:4)
SELECT * FROM (select ROW_NUMBER() OVER (ORDER BY publishdate DESC) as RowNum,
* FROM news WHERE publishdate <=getdate()) as info
WHERE RowNum > 0 AND RowNum <= (100)
您不需要'
in(ORDER BY发布日期DESC)
答案 1 :(得分:0)
为了将来的参考,我在查询不存在的数据页面时也看到了这个错误(要求的数据行数比数据库中存在的数量多)。