Hi,

No, you can't get both in one query.

Anyway, you probably want to see how many results
would be returned in the first place,
before deciding on sensible LIMIT clause parameters.

And you may want to add an ORDER BY clause to your second query,
so that you can rely on the order in which the results are returned.

If speed is the reason for your worries, 
why not add an index on 'price'?

Jan


michalm wrote:
> 
> I need to get information about number of all rows produced by query 1)
> and information produced by limited query 2).
> I can do this in these 2 queries.
> |---------------------------|
> |How to get it in ONE query?|
> |---------------------------|
> 1)
>   mysql> SELECT count(*) FROM  t_what WHERE price<25;
>   +----------+
>   | count(*) |
>   +----------+
>   |       25 |
>   +----------+
>   1 row in set (0.00 sec)
> 
> 2)
>   mysql> SELECT what_oid, what_pl_name FROM t_what WHERE price<25 LIMIT 0,10;
>   +----------+--------------+
>   | what_oid | what_pl_name |
>   +----------+--------------+
>   |        1 | Misja        |
>   |        2 | System       |
>   |        3 | Clueless     |
>   |        4 | Fortepian    |
>   |        5 | Sebastian    |
>   |        6 | Carrington   |
>   |        7 | Casablanca   |
>   |        8 | Dziwne dni   |
>   |        9 | Wyliczanka   |
>   |       10 | Mozarella    |
>   +----------+--------------+
>   10 rows in set (0.02 sec)
> ----------------------------------------
>  Michael Mierzejewski                        mailto:[EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to