I have a forums model that has many topics, each topic has many comments. I would like to sort the topics by the create_time in the comments, so the topic with the latest comment will be listed first.
You can include other CCriteria properties in the relation, such as with ect. and order by MAX( create_time ). You might want to consider denormalising slightly and storing the last updated information in the forum table and updating it when people comment. This would reduce the load on your database when doing the query.