Hello,
I have a big web-site(ASP.NET) with a huge data-base(MS-SQL) and i searched for a good way to use paging in my web-site.
I found two good way's to do it but i have a little problem to decide which paging way to use,
The first way to is to use ROW_NUMBER() in this why:
With ListRec As(
SELECT ROW_NUMBER() OVER(ORDER BY field1,field2) AS rownum,field1,field2,field3 FROM [MyTable] WHERE MyCondition
)
SELECT *
FROM ListRec
WHERE rownum > 90 and rownum <= 100
The second way to is to use NOT IN in this why:
SELECT TOP 10 field1,field2,field3 FROM [MyTable]
WHERE (field1 NOT IN (SELECT TOP 90 field1 FROM [MyTable] WHERE MyCondition ORDER BY field1,field2)) And MyCondition ORDER BY field1,field2
So, Which way is the best way ?
Thanks,
Roy Shoa.