Table Sorting On Calculated Field

Hello my friends!

Supposing I have table user and I want to display a table (CGridView or something else …) with sorting:

  Blling info

username email balance

where balance column is always calculate like this


, where


  • is id of current row user

So I don’t know how to sort on balance field.

Maybe there is some Yii-way.

Please help me.