How do i limit the result of a query (in my case about 60K rows) and select only from the X row to the Y row?
If I use ROW_NUMBER() I don t like my query because it involves 2 select queries .. one to return the rows and one to select the portion I need
Update:
Here s the query I use now:
SELECT *
FROM (
SELECT row_number() OVER (ORDER BY E.LastChangeDate DESC) AS row, E.*, U.[DisplayName] AS EntryCreatorDisplayName, U.[Email] AS EntryCreatorEmail
FROM entries e
INNER JOIN
users u
ON e.fk_user= u.id
WHERE e.EntryRank = 2
AND u.Administrator = 1
) as TableWithRows
WHERE (row >= 31 AND row <= 60)