Mysql Insert Into xx (Select From... with CDBCommand

Hi all,

Is there any way to execute a query like:

INSERT INTO table1 (id, name) (SELECT id, concat(a, <img src='' class='bbc_emoticon' alt='B)' /> as name FROM table2);

with the classical CDbCommand interface?

I’ve tried some variants of

$res = Yii::app()->db->createCommand()

			->insert('table1', 'id, name')

			->select('id, name')  // Ommited the concat part for simplicity




But none of them have worked in any way

I am trying to insert some columns of a table in another, just to have a fulltext index separated from the main table, and update it once in a while.

I think I will have to do it querying the database directly… :confused:

Thanks in advance!

Finally I did it this way, I put it here in case someone find it usefull.

I havent found an other one, and it is not that ugly after all:

$sql = 'INSERT INTO {{table1}} (id, name) (SELECT id as id, concat(name,\' \',surname1,\' \',surname2) as name FROM {{table2}});';

$res = Yii::app()->db->createCommand($sql)->execute();

Thanks anyway, yii rules :)