具有Where子句SQL查询的OFFSET

时间:2015-12-07 09:38:27

标签: sql linq linq-to-sql

我面临着OFFSET的一个奇怪问题(在linq中使用skip)。当我使用where子句并过滤空值时,offset会以错误的顺序返回记录。

select * from ExpectedApplication where ApplicationId is null
order by PaymentDate desc 
OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY 

select * from ExpectedApplication where ApplicationId is null
order by PaymentDate desc 
OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY 

输出是:

enter image description here

由于这个问题,我的分页结果是返回不正确的数据。请帮忙。非常感谢提前。

此致 的Vivek

1 个答案:

答案 0 :(得分:0)

enter image description here

我上传了新图片,其中还显示了PaymentDate列。你是对的,支付日期对于那些id是相同的,但是为什么它改变了序列。