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 <liaog...@gmail.com> 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to