Can't you just keep track of which page you are on, and multiply by 20
(except for the last page)? I must be missing something.

Regards,

Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341


> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Gareth Adams
> Sent: Wednesday, October 18, 2006 11:25 AM
> To: mysql@lists.mysql.com
> Subject: Finding the 'page' number of a record, or its
> position in resultset
>
> Hi,
>
> We have an application which queries our database in 'pages',
> i.e. uses the same
> query repeatedly, with a different "LIMIT x, 20" to display
> blocks of 20 results.
>
> I'm wondering if there's an easy way (or any way) to find out
> where in the
> resultset a particular record lies. Obviously the query we're
> paginating could
> involve an ORDER clause, so this isn't any information that
> can be stored in the
> table.
>
> I realise that a row in a resultset might not correspond to a
> record, so I
> figure this would involve some kind of subquery, I just don't
> know what it would
> involve.
>
> I realise that this processing could be done in the
> application, but that would
> involve loading the entire resultset into memory, which would
> pretty much ruin
> the point of the pagination.
>
> Hopefully it won't be too painful to work this out
>
> Gareth
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/[EMAIL PROTECTED]
>
>




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to