Damir Dezeljin wrote:
>>>----
>>>SELECT <something>
>>>    FROM test
>>>    WHERE (kid=1) OR (kid=2) OR (kid=4)
>>>    GROUP BY cid,aid;
>>>----
>>>Is it posible to get number of rows with such a query from MySQL v3.23.49?
>>
>>You want both a list of rows, and a count of the number of rows -- with
>>a single query.  That doesn't make sense, because those two things are
>>incompatible.
> 
> I make a mistake by not specifing my problem in more detail. I will try to
> be more specific:
> 
> I'm writing my own search engine for my web site. I want to output for
> each result on each page (20 results per page) the no_of_current_result /
> no_of_total_results . So with a first query I want to get a count of the
> number of rows. Then I will execute a query with LIMIT <blahblah> to get
> results for the current page.
> 
> Is it posible to get number of all results without geting all results in a
> temporary table and then count them? If yes, how?

SELECT COUNT(*)
  FROM test
  WHERE (kid=1) OR (kid=2) OR (kid=4)
  GROUP BY cid,aid;

Should do it, or am I missing something ?

> 
> Thanks and regards,
> Dezo
> 
> 


Hope this Helps
Joseph Bueno


---------------------------------------------------------------------
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