[SQL] Dynamic Offset Determination

2005-07-13 Thread David Blankley
Problem Statement: I want to return n rows from a table. These n rows are relative to an offset. The part I can't figure out: The offset needs to be determined from values in the rows. Example: Given a table foo: CriteriaCol integer OrderedCol integer I can figure out the number of rows

Re: [SQL] Dynamic Offset Determination

2005-07-13 Thread David Blankley
I came up with a clever solution to this myself... I know the determined value for my CriteriaCol, so I can simply get the count of all the rows with criteria <= my value... SELECT count(*) FROM foo WHERE CriteriaCol<=constraint ORDER BY OrderCol; Thanks, Dave --