Be kind, tell me
How to change db (database) in Query Builder?
Example:
$q1 = (new \yii\db\Query()) ->select([ "col1", "col2", "col3" ]) ->from('table1'); $q2 = (new \yii\db\Query()) ->select([ "col1", "col2", "col3" ]) ->from('table2'); $query=$q1->union($q2); $query = \Yii::$app->db2->createCommand($query); $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); The request is performed for a database that is db. I receive "Object of class yii \ db \ Query could not be converted to string"
Thank you for the answers.
db2...... You looked that at you the request returns? - Alexey Shimansky