Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
tennis_blues
Forum Newbie
Posts: 21 Joined: Sun Oct 20, 2002 8:30 am
Post
by tennis_blues » Sat Jan 07, 2006 11:45 am
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 » Sat Jan 07, 2006 11:57 am
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.