我想如何UNION ALL
使用CActiveDataProvider
criteria
.
表示例:
ID NAME
1 John
查询示例:
SELECT * FROM users
UNION ALL
SELECT * FROM users
回复:
ID NAME
1 John
1 John
它CDbCriteria
似乎不处理UNION ALL
相反,您可以使用CSqlDataProvider
该类
$sql='SELECT * FROM tbl_user UNION ALL SELECT * FROM tbl_user ';
$dataProvider=new CSqlDataProvider($sql, array(
'totalItemCount'=>$count,
'sort'=>array(
'attributes'=>array(
'id', 'username', 'email',
),
),
'pagination'=>array(
'pageSize'=>10,
),
));
// $dataProvider->getData() will return a list of arrays.