How to select between the top 50 and 100 returned (queried) rows in sql?

SELECT TOP(100) * FROM dbo.users
EXLUDE TOP(50)
WHERE users.name = 'John'

Is there something like my code above? Essentially, I am attempting to NOT select the first 50 records that return with the name John, but the second set of 50 (51-100). I'd like to change this range as needed (to anything from 51-100 to 879-1013, not literal).

The record identity number will not help as John, then Sally, then Kate, then another John may have signed up, so I don't believe that WHERE BETWEEN will work....



Read more here: https://stackoverflow.com/questions/68492380/how-to-select-between-the-top-50-and-100-returned-queried-rows-in-sql

Content Attribution

This content was originally published by Scott Shaffer at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: