Condition in SQL Query

Can anyone suggest me how to use condition (if … else) in sql query in Yii?

Just use createCommand() to create a custom SQL command using the following syntax:

http://www.yiiframework.com/doc/guide/1.1/en/database.dao#binding-parameters

This is not what I want.