Re: finding a particular record within a MySQL result set

From: Date: Wed, 04 Apr 2007 21:36:14 +0000
Subject: Re: finding a particular record within a MySQL result set
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-252069@lists.php.net to get a copy of this message
2007/4/4, James Tu <jtu@esidesign.com>:
I've cross posted this to the MySQL list... Here's my original post. Is there some quick way to do the following in MySQL? (I know I can use PHP to search through the result set, but I wanted to see if there's a quick way using some sort of query) Let's say I know that Joe is from Maine. I want to do a query of all employees from Maine, ordered by hiring date, and figure out where Joe falls in that list. (i.e. which record number is he?) -James Here's my new plan of attack... Right now I'm trying to use PHP to do a binary search on the result set so I don't have to traverse the entire result set. I'm using PHP's mysql_data_seek() to move the pointer within the result set and looking at the data to do the necessary comparisons. What do people think of this approach? -James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php There is a previous thread in this list regarding the same topic:
http://marc.info/?t=116688638100001 This is the solution I've used for this kind of problems, and posted as a response to that thread: http://marc.info/?m=116697534311544

« previous php.general (#252069) next »