Imagine the following situation,
table tvEpisode attributes:
id, tvShow_id, title, airDate,
table tvShow attributes
i want to do tvShow::model()->with($something)->findAll() such that for each tvShow one tvEpisode is loaded from the database, and i want that one tvEpisode to be the tvEpisode with the highest airDate(stored in unix time() format).
I’m not sure how exactly to go about with this. I have a piece of sql that can be used to generate a table containing the ids of all the tvEpisodes that have the highest airDate, but not sure how to tie it into with(). Is there any way i can specify ‘id IN (subquery)’ or some such with the with() clause?