Select ... AS newColumn with CDbCriteria?

Hi,

how can I create SELECT … AS statements with a criteria?

like …


$criteria->select = "CONCAT(a,<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='B)' /> AS c";

but this does not work.

Best regards,

schmunk

Did you try to declare a public variable in the model that uses that criteria? (in this case the variable must be called $c)

No, I just wanted to do some custom things in my SELECT statement, I do not want a public variable for that.

Maybe I have to stick with this:

http://www.yiiframework.com/doc/api/CActiveFinder#findAllBySql

You can probably do this with the combination of alias and CDbExpression.

mmm you ever find a solution? am hitting against the same wall :) I dont see how alias or CDBExpression can help ?

thanks Im having the same problem and now I can use the alias when I declared it as public variable on my model… thanks a lot

Don’t know it was that easy lol, thanks