SELECT TOP 15 * FROM tableName WHERE limit AND (pk NOT IN (
SELECT TOP pageNum pk WHERE limit ORDER BY theDate DESC)) ORDER BY theDate DESC
SELECT TOP pageNum pk WHERE limit ORDER BY theDate DESC)) ORDER BY theDate DESC
SELECT TOP 15 * FROM tableName WHERE limit AND (pk NOT IN (
SELECT TOP pageNum pk FROM tableName WHERE limit ORDER BY theDate DESC)) ORDER BY theDate DESC
SELECT TOP 15 *
FROM #ttt
WHERE limit AND id>(pagenum-1)*15
drop table #ttt
SELECT TOP pageNum pk FROM tableName WHERE limit ORDER BY theDate DESC)) ORDER BY theDate DESC--你子查询没加 ORDER BY theDate DESC,因为查询前数据库对查询语句进行优化,
--这样可能按不同的字段排序,所以你要加入排序字段和顺序。--子查询和外查询的排序是一样的。