tags:

views:

31

answers:

1

I have 2 tables subscribers and distribution list and the relationship between them is HABTM. Now here particular users are associated to distribution list, i wish to add more users, but when adding new users to distribution list, i would like to show users who are not associated with that distribution lists. what condition should i write

A: 
$this->DistributionSubscriber->find('list', array('conditions'=>array('distribution_id <>' => 1), 'fields'=>array('subscriber_id'), 'recursive'=>-1));

I would try something like this. You want to start with the join table in this case, and do your find() from there. I haven't checked this syntax, but you should get the idea.

Dooltaz
@Dooltaz this would give me list of subscribers which are NOT there in the distribution list but rest of the entries in that join table
Avinash