Sorry this doesnt work. It still gives me this error: Warning (512): SQL Error: 1054: Unknown column 'SubscriberContact' in 'where clause' [CORE/cake/libs/model/datasources/dbo_source.php, line 514]
is there a way to use joinModel method? On May 6, 3:59 pm, Mohsin Kabir <[email protected]> wrote: > Hello , > There is easy solution here : > > here you should > First: > make association > > subscribers has many subscriber_contacts and > subscriber_contacts belongs to subscribers > > Second: > > # find IDs of friends here > $friends = $this->Subscriber->SubscriberContact->find(’list’, > array(’conditions’ =>array(‘SubscriberContact.contact_no like ’ => ‘ > 03-20934662%’))); > # merge conditions > $conditions = Set::merge($conditions, array(‘Subscriber.id’ => $friends)); > > $this->Subscriber->find(’all’, array(‘conditions’ => $conditions)); > > I think i will help you .... > > On Wed, May 6, 2009 at 12:45 PM, liaogz82 <[email protected]> wrote: > > > Hi all, > > > i need help to convert the following MySQL query to cakePHP find. I > > have 2 tables: subscribers and subscriber_contacts. One subscriber has > > many subscriber_contacts. The following is the MySQL query: > > > SELECT s.* FROM subscribers s, subscriber_contacts sc where s.id = > > sc.subscriber_id and sc.contact_no like '03-20934662%'; > > > So question here: how to convert the above MySQL command into a find()? > > -- > --~--~---------~--~----~------------~-------~--~----~ > Thanks, > Mohsin Kabir > --~--~---------~--~----~------------~-------~--~----~ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
