CDbCriteria compare with another column, not value

Hello.

I need to run a complex search using CDbCriteria and at some point it should compare not with a fixed value, but with another column value.

Ex.:

$criteria->compare(‘column1’,’>column2’);

where column1 and column2 are MySQL table columns.

I’ve tried

$criteria->compare(‘column1’,new CDbExpression(’>column2’));

but it doesn’t work.

Please help.

Thank you.

try

$criteria->addCondition(‘column1 > column2’);