|
Posted by Tom on 06/20/07 17:52
On Wed, 13 Jun 2007 09:00:11 GMT, cluthz wrote...
>
>Hi there,
>
>I have query which returns to many results to handle (therefore to be
>displayed screen at one time and to be transferred from the server).
>
>I therefore want to create a search results screen which displays a limited
>subset of query results and the user of the application can control which
>subset of results are displayed (e.g. say there are 10000 matching results,
>the user can see results 1-500, and move on in batches of 500).
>
>The only thing is, to get the amount of rows I still have to run a very
>similar (and therefore big) MySQL query as if I was getting all 10000
>results, just to find out how many results there actually are.
>
>So am I right in thinking this is the way to go about it. Therefore I run
>the query once but only ask for a count of results to be returned. This
>gives me the total amount of matches.
>Then I run the query again, this time returning all the fields information,
>but this time I use LIMIT to restrict the actual results.
>
>I hope this question makes sense and thanks in advance for any input.
>
>
>
If you use "LIMIT" on your SQL query, then the total count would be limited to
the range you pick. You might need to run a couple of queries, one to get the
total count, and the other to get the results with a limit to control the range
you need to output.
Tom
--
Newsguy.com - Unlimited Accounts
Now with 32 concurrent connections
Navigation:
[Reply to this message]
|