Aggregate Column In Cactiverecord

Hi,

how to implement in CActiveRecord this kind of query:


SELECT *, (SELECT COUNT(*) FROM table AS tmp WHERE tmp.column1 = table.column1 AND tmp.column2 = table.column2 AND tmp.date_column <= table.date_column) AS count FROM table

Could anyone tell me is it possible to do that in CActiveRecord data model and if answer is yes where to put (and what) code for custom column with nested query?

Thanks for any help.