如何在Zend Framework1中使用sum语句

时间:2016-01-14 09:41:00

标签: zend-framework

如何在 zend框架中使用 aggerate function

$select = $this->select()->from(dailyusages, new Zend_Db_Expr("SUM(offPeakTotal)"));

1 个答案:

答案 0 :(得分:0)

示例

$select = new Zend_Db_Select($dbadapter);
$result = $select
    ->from(
        'table_name',
        array(
            'offPeakTotalSum' => 'SUM(offPeakTotal)'
        )
    )
    ->query(Zend_Db::FETCH_ASSOC)
    ->fetch();
var_dump($result);