1
我仍然試圖用PHP創建分頁,但SQL SERVER(2008)不支持偏移和限制。下面你可以看到SQL查詢,但我不知道什麼是錯的:PHP分頁使用SQL SERVER 2008
declare @offset int
declare @limit int
set @offset = 2;
set @limit = 20;
SELECT *, ROW_NUMBER() OVER (ORDER BY use_by_date desc) AS RowNum FROM DB
WHERE RowNum >= @Offset
AND RowNum < @Offset + @Limit