2009年10月28日星期三

Re: [fw-db] Zend_Db_Table and mysql COUNT() function

Why fetching all rows if you need just count? It's far faster to select count (*).

Regards,
Saša Stamenković


On Wed, Oct 28, 2009 at 11:15 PM, Ralph Schindler <ralph.schindler@zend.com> wrote:
What rows do you want to count?

If you get a rowset back, you can always call count:

$rowset = $table->fetchAll('foo = "bar"');

echo count($rowset);
// OR
echo $rowset->count();

Does that help? I feel you might have a more specific question, but that basically is counting an existing rowset.

-ralph



greg606 wrote:
Hi
I have a table (Zend_Db_table object) and I want to count rows.
What is the simplest way to do it? ;)

Regards
Greg

没有评论: