How can I use the MySQL GROUP BY WITH ROLLUP modifier in Zend_Db_Select?

The SQL query in my web application (PHP / MySQL + Zend) uses a number of parameters to build the search query. However, the resulting records must be grouped into two columns in order to get the totals. With ROLLUP, it seems like a good solution for finding subtotals, but Zend_Db_Select does not support this modifier. Is there any work around?

+3
source share
1 answer

Well,

$select->from(array('t1' => 'table1'))
    ->where("where");
    ->group("(field1)  WITH ROLLUP");
+6
source

Source: https://habr.com/ru/post/1789701/


All Articles