I’m using CActiveDataProvider to provide a recordset to CGridView. As you can see below, I “ROLLUP” my values to include a total value at the end of my recordset. In order to ensure “group_name” is not null I include the condition IFNULL statement. When yii runs this query it parses the IFNULL. My log shows the beginning of the query like so:
t0_c2, "Total") AS group_name
You’ll may have noticed the missing IFNULL part.
Here is my data provider:
$summary = new CActiveDataProvider('AccountData', array( 'criteria' => array( 'select' => 'IFNULL(g.group_name, "Total") AS group_name, amount', 'with' => 'prebudget', 'alias' => 'g', 'condition' => 'SUBSTRING(account, 7, 3) IN (' . $departments . ')', 'group' => 'g.group_name WITH ROLLUP', ), ));
Is this what yii is supposed to do? I’m using MySQL and works as predicted when writing my own SQL statement. As always, thanks in advance!!