本帖最后由 HM刘磊 于 2013-4-15 02:01 编辑
use SMSstudent
go
/*第一种分页方法 */
SELECT TOP (5) studentID, studentName, nation, sex, birthday, classID, telephone, credithour, ru_date, address, pwd, remark
FROM student
WHERE (studentID NOT IN
(SELECT distinct TOP (5) studentID
FROM student AS student_1
ORDER BY studentID DESC))
ORDER BY studentID desc
/*第二种分页方法*/
select studentID, studentName, nation, sex, birthday, classID, telephone, credithour, ru_date, address, pwd, remark from (
select (row_number() over(order by studentID desc) ) as IDa,* from student ) as ids where ids.ida>5 and ids.ida<=10
上面Sql代码都实现了查询指定条目行数据的功能,我想问在实际工作中一般用那种方法,
实际测试中哪个性能好? |