Article::model()->with('Category')->together()->find...
select ... from articles where id in (select id from article_categories)