$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);
그러나 다음과 같은 코드를 가지고, 나는 단지 여기에서 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,이 문제는 젠드 프레임 워크에 특정하지 않습니다. SQL 쿼리에서 집계 함수를 사용하는 데 문제가 있습니다. 단일 쿼리에서는 집계 데이터 또는 사전 집계 데이터 행을 가져올 수 있지만 둘 다 가져올 수는 없습니다. –
이것은 [다른 질문]과 유사합니다 (http://stackoverflow.com/questions/983419/is-there-a-way-to-get-the-number-of-records-from-a-query-with- 젠드 프레임 워크/984283 # 984283). – Justin