MSSQL paging with CTE
No LIMIT OFFSET as in PostgreSQL or MySQL.
WITH cte AS
(
SELECT ROW_NUMBER() OVER(ORDER BY country ASC) AS RowNumber
FROM company WHERE country='Malaysia'
)
SELECT * FROM cte
WHERE RowNumber > 0 AND RowNumber < 100
No LIMIT OFFSET as in PostgreSQL or MySQL.
WITH cte AS
(
SELECT ROW_NUMBER() OVER(ORDER BY country ASC) AS RowNumber
FROM company WHERE country='Malaysia'
)
SELECT * FROM cte
WHERE RowNumber > 0 AND RowNumber < 100