私は次のコードカウントmysqlのクエリ
$result = $handle->select()->from('store_products_id', array('count'=>'COUNT(store_products_id.product_id)'))
->where('store_products_id.store_id=?', $this->store_id)
->columns($selectColumns)
->join('product_quickinfo', 'store_products_id.product_id =
product_quickinfo.product_id')
->join('image_paths', 'product_quickinfo.image_id =
image_paths.image_id')
->order('product_quickinfo.date_created DESC')
->limitPage($this->page_number, $this->sum_each_page)
->query(ZEND_DB::FETCH_OBJ);
しかし、私は戻って1件の結果を得る..ここますprint_rを見ています:
Array ([0] => stdClass Object ([count] => 14 [small_path] => 1 [product_name] => v evrecvrv [price] => 22 [product_id] => 1 [image_id] => 1 [date_created] => 0000-00-00 00:00:00 [large_path] => [description] =>))
私はCOUNTコントローラを削除すると、Iをすべてのアイテムを元に戻す。 どのようにしてクエリ全体(LIMITを超えて)をカウントすることもできますし、クエリ全体を戻すこともできますか?
ありがとうございました。
FWIW、この問題は、Zend Frameworkのに特定ではありません。 SQL問合せでの集約関数の使用に関する問題です。 1つのクエリでは、集計または集計前のデータ行を取得できますが、両方を取得することはできません。 –
これは[別の質問](http://stackoverflow.com/questions/983419/is-there-a-way-to-get-the-number-of-records-from-a-query-with- zend-framework/984283#984283)私は答えました。 – Justin