多对多关系取值问题

比方说post和category

1个post包括多个category

1个category包括多个post

我想取1个post ,而这个post的所有category都不包含id为10 的category 怎么取?

我之前用了 $posts=Post::model()->with(array (‘categorys’ => array(condition => ‘id!= 10’)) )->findAll();

这样取到的post仔细一看,在关联表中 数据不正确,貌似应该用sql的 not in?