nth record of table

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
tennis_blues
Forum Newbie
Posts: 21
Joined: Sun Oct 20, 2002 8:30 am

nth record of table

Post 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!
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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.
Post Reply