Lithium ORM 中多列的 SUM 函数

SUM function on multiple columns in Lithium ORM

我想要这样的东西:

    $res = Model::find('all', array(
        'fields' => array(
            'SUM(col1)' => array(
                'alias' => 'col1_total',
                ),
            'SUM(col2)' => array(
                'alias' => 'col2_total',
                )
            )
        );

预期生成 SQL:

    SELECT SUM(col1) AS col1_total, SUM(col2) AS col2_total 
    FROM `tbl` AS `Model` WHERE 1;

我尝试了很多方法。 这可能吗?


单个列的工作示例:

        $res = Model::find('all', array(
            'fields' => 'SUM(col1)'
            )
        );

酷!
工作示例:

    $res = Model::find('all', array(
        'fields' => array(
            'SUM(col1) AS col1_total',
            'SUM(col2) AS col2_total'
            )
        );