Page 1 of 1

nth record of table

Posted: Sat Jan 07, 2006 11:45 am
by tennis_blues
how do i get the nth matching record of the query.....i dont know the unique id in the query, so all i can do is find the nth record...

select *
from address
where address.street = "main street"

in this query, there is likely to be a bunch.....but i want the query to return only one each time...

thanks so much for any help!

Posted: Sat Jan 07, 2006 11:57 am
by timvw
With standard SQL it's impossible... Btw, in a query without ORDER BY clause there is no such concept as n-th row because they are unordered per definition..

Anyway, MySQL and PostgreSQL have a LIMIT clause and MS-SQL has a TOP clause.