For example, posts table is in db1, categories table and category_post_join table are in db2. How to declare a many-to-many relationship between Post model and Category model?
'categories'=>array(self::MANY MANY, 'Category', 'category_post_join (post_id, category_id)')
works only if all tables are in the same database.