In Yii2 How to insert data from one table to another table.
Here i have two tables table1
and table2
.
Now what i need is when a condition met i need transfer a specific data from table1
to table2
.
so help to write insert Query for this scenario in Yii2
This is the insert query given in yii2 docs
Yii::$app->db->createCommand()
->insert('user', [
'name' => 'Sam',
'age' => 30,
])->execute();
But i need this Query to be convert according Yii2 Query
INSERT INTO Customers (CustomerName, Country)
SELECT SupplierName, Country FROM Suppliers;