Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Query q = ...;
- q.setFirstResult (0);
- q.setMaxResults (10);
- N - upper bound
- M - lower bound
- create #temp (Id int identity, originalId int)
- insert into #temp(originalId)
- select top N KeyColumn from MyTable
- where ...
- select MyTable.* from MyTable
- join #temp t on t.originalId = MyTable.KeyColumn
- where Id between M and M
- order by Id asc
- drop #temp
Add Comment
Please, Sign In to add comment