MySQL Forums
Forum List  »  Newbie

Position of a record in a given SELECT statement?
Posted by: Wojciech Ciesielski
Date: September 03, 2004 02:34AM

Hi there...

I want to make an iteration (on www) through some dataset (let's say - address book). One record maight be:
- third out of 1200 from city MyCity
- 134th out of 102000 from district MyDistrict
- etc...

Any ideas how to get position in any of those subsets in some elegant way? Till now I was doing

SELECT someID FROM address WHERE myCondition(ie. city=MyCity) ORDER BY neededOrder

and then iterated one by one through result searching for my ID and therefore knew it was ie 10th out of 120. Everyone will certainly agree that it's not elegant and far from optimized...

TIA

Wojtek

Options: ReplyQuote


Subject
Written By
Posted
Position of a record in a given SELECT statement?
September 03, 2004 02:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.