I am looking to retrieve a certain record of a result set, but not by means of a traditional primary key. Instead, I would like my query to receive an integer from a method, and retrieve that record in the result set (e.g. the method sends it '4', then it must retrieve the 4th record in the result set.)
For example, I run the query "SELECT * FROM table WHERE fieldname='Yes'" on the following data:
Data
ID, fieldname
1, Yes
2, No
3, Yes
4, Yes
5, No
Result Set
ID, fieldname
1, Yes
3, Yes
4, Yes
This query should return all rows that have 'Yes' for a fieldname value. Let's say that I wanted to retrieve the second row of the result set.
Is there a way to the row "3, Yes" if the number supplied by the method was '2' (as I am trying to get the 2nd record in the result set)?