Solution to SQL Server SQL statement query for paginated data_PHP tutorial

WBOY
Release: 2016-07-13 17:00:29
Original
1159 people have browsed it

For example: it is required to select the record on page 3000 in tbllendlist, with 100 records on each page.
----------
Method 1:
----------
select top 100 * from tbllendlist
where fldserialNo not in
(
select top 300100 fldserialNo from tbllendlist
order by fldserialNo
)
order by fldserialNo
----------
Method 2:
- ---------
SELECT TOP 100 *
FROM tbllendlist
WHERE (fldserialNo >
(SELECT MAX(fldserialNo)
FROM (SELECT TOP 300100 fldserialNo
FROM tbllendlist
ORDER BY fldserialNo) AS T))
ORDER BY fldserialNo
Method 1 executes faster!
However, this approach is still very troublesome. I strongly look forward to Microsoft inventing a new paging SQL statement! ! ! !


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631234.htmlTechArticleFor example: it is required to select the record on page 3000 in tbllendlist, with 100 records on each page. ---------- Method 1: ---------- select top 100 * from tbllendlist where fldserialNo not in ( se...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!