var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: How to find a record by number
What would be the best way in SQL to query a table to return a single record by number?
Let's say I want record number 49 and my primary key is a text field so a numeric key is out of the question.
I think I figured it out unless anyone has a better way.
SELECT TOP 1 * FROM (SELECT TOP 49 * FROM [Table] ORDER BY [Key] ASC) AS Whatever ORDER BY [Key] DESC
Last edited by wey97; 05-04-04 at 19:14.
That looks like a bad idea. If you pass any number bigger than the max number of records in the table, you always get the last record.
which row did you want, the 49th? by which column?
and yes, if there are fewer than 49 rows, it would seem appropriate (at least, it seems so to me) to choose the last one
what database are you using? this forum is for non-specific (i.e. standard) sql
you may want to consider the Access or SQL Server forums, if TOP works in your database