List:General Discussion« Previous MessageNext Message »
From:James Tu Date:March 26 2007 6:02pm
Subject:Re: Finding a record in a result set
View as plain text  
Let me describe the problem another way, too.  It's related to  
creating a paging interface to view many records.  I figured that  
people deal with paging all the time and the solution to my problem  
may already be out there.

Typically when you access a single record via a top down method, i.e.  
you page through records and then you click on a specific record, you  
still have information that allows you to go back to the paging view.

But what do people do if:
(1) Somehow, while you're browsing a single record, the database is  
updated and records are added.  The order of the record that your  
browsing within the entire list of records could be shifted.  When  
you go back to page view, you actually need to figure out the  
position, within your overall result set, of the current record that  
your browsing and then you have to figure out which 'new' page the  
record appears on.

or

(2) You browse to a specific record via let's say a search, and then  
you want to step back to page view to see where this record lives in  
the overall result set. (I guess this problem is the same as (1), b/c  
it's all about going from a detail view to a page view and figuring  
out it's position relative to everything so you can form the pages  
accordingly)


Is there a way to do this in MySQL through a query or do I need to  
get the ENTIRE result set into, let's say PHP and figure it out, and  
then do another query for just a page of results?

-James


On Mar 22, 2007, at 11:21 AM, James Tu wrote:

> 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
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql? 
> unsub=jtu@stripped
>
>


Thread
Finding a record in a result setJames Tu22 Mar
  • Re: Finding a record in a result setPeter Brawley22 Mar
    • Re: Finding a record in a result setRolando Edwards22 Mar
    • RE: Finding a record in a result setJerry Schwartz22 Mar
      • Re: Finding a record in a result setFrancesco Riosa23 Mar
      • SPAM ?Jacques Brignon24 Mar
        • Re: SPAM ?LP24 Mar
        • Re: SPAM ?Martijn Tonies24 Mar
        • Re: SPAM ?Stephen Cook25 Mar
          • RE : SPAM ?Jacques Brignon25 Mar
            • RE : RE : SPAM ? SOLVEDJacques Brignon25 Mar
        • Re: SPAM ?Banyan He25 Mar
          • RE : SPAM ?Jacques Brignon25 Mar
            • Re: SPAM ?Banyan He25 Mar
  • Re: Finding a record in a result setRolando Edwards22 Mar
  • Re: Finding a record in a result setMaciej Dobrzanski24 Mar
    • Re: Finding a record in a result setJames Tu26 Mar
  • Re: Finding a record in a result setJames Tu26 Mar
  • Re: Finding a record in a result setJames Tu4 Apr
    • RE: Finding a record in a result setJerry Schwartz4 Apr
      • Re: Finding a record in a result setDan Buettner4 Apr
        • Re: Finding a record in a result setJames Tu4 Apr
          • Re: Finding a record in a result setDan Buettner4 Apr
      • Re: Finding a record in a result setJames Tu4 Apr