Num Results and Group By

admin

Administrator
Staff member
I am trying to get the total number of results from my query without using
mysql_num_rows() (in php).

This usually works fine for a regular query but since I'm using group by,
I'm getting a set of rows, which is meaningless for this purpose. I have to
use group by or the query won't make sense either.

SELECT COUNT(*) AS total_num_results
FROM qvi_word_index
WHERE word IN ('warehouse','systems','oracle')
GROUP BY project_id

In this case, do I have to use mysql_num_rows? I'm trying to stay away from
implementation specific sql statements.

Thanks,
Matt.
 
Back
Top