⌘BABAKOV.NET Let's code!
100% [light] [ru]

OFFSET FETCH - Limiting Result Set in MSSQL

"OFFSET FETCH" is a filter that allows skipping a certain number of rows in the result set.

For example:

select field1, field2, field3 
from table1
order by field1, field2
offset 100 rows fetch next 50 rows only;

This example will return rows from 101 to 150, from all rows sorted by field1 and field2.

! First, the sorting will be performed, then 50 rows will be returned.

! For large data volumes, this method requires a lot of resources, so it is better to use it on minimized result sets.

Comments (0)

No comments yet.

Leave a comment
Comment
Images (up to 5 MB)
Your comment will appear after moderation.