select top 5* from product where id>=select max(id) from (select top (@pageSize*(@pageIndex-1)+1)id from product )as t)上面这段代码是在C#里拼接的SQLselect top 10* from product where id>=select max(id) from (select top (10*(2-1)+1)id from product )as t)
--这段代码直接在查询分析器里跑的但是两个结果 却不一样 第一段代码 可以正常分页
第二段 代码只能取到最后一页和第一页 加上order by id  可以正常分页
为什么SQL代码一样结果却不一样,而且加上order by 来排序和不加查询出来的结果都一样为什么在分页查询中 不加order by 却出问题
sql分页