Query one record in table

G

Gibson

Is there a way to query one record from a table. Specifically say the second
record or the third record. I mean the criteria would not be specific data
it would simply be the order of the records. I want to see the fourth record
for example.

Thanks.
 
M

Marshall Barton

Gibson said:
Is there a way to query one record from a table. Specifically say the second
record or the third record. I mean the criteria would not be specific data
it would simply be the order of the records. I want to see the fourth record
for example.


No such thing as the "fourth" record in a table. The data
in a relational database's tables is inherently unordered.

To do what you want, you must have a data field to determine
that order of the records. Once you have a data field that
can be used to uniquely order the records, you can retrieve
the using several types of queries. One might be:

SELECT TOP 1 T.*
FROM (SELECT TOP 4 X.*
FROM table As X
ORDER BY X.sortfield ASC) As T
ORDER BY T.sortfield DESC
 
Top