I have a question regarding zend db. I would like to select all the data from a table + an expression such as a count.
Unfortunately, when you pass an array with count in the select object, it will only select the count. As the table is really big, i prefer not to list all the columns in the table for the select.
Do you have any idea?
You should add a group by to your select object. This makes sense because the aggregate functions are used in conjunction with the GROUP BY statement.
$select = $db->select();
$select->from(array('p' => 'product'), array('product_id','title', 'count(*)'));
$select->group('title');
$products = $db->fetchAll($select);