(ehsepulvedao) #1

Hello everyone,

I am trying to translate this code:

INSERT INTOapp_user_pruub(cedula, nombre, apellido) SELECT CAMPO01 As cedula,CONCAT( CONCAT(CAMPO02,’ ‘), CAMPO03) As nombre, CONCAT( CONCAT(CAMPO04,’ '), CAMPO05) As apellido FROM app_employees WHERE 1

I want to write it in the Yii framework, I have written this code, but when I execute it, it only copies a quarter of the data.

public function actionProcess(){

        $data = Yii::app()->db->createCommand()
                ->select(['CAMPO01 AS cedula1',"CONCAT(CAMPO02, ' ', CAMPO03) AS name", "CONCAT(CAMPO04, ' ', CAMPO05) AS lastname"])
        foreach($data as $key => $value){
        $data2 = Yii::app()->db->createCommand()
            //echo '<br>';

Could someone tell me what’s wrong ?. Thank you.