Tuesday, August 4, 2009

Big SELECT. Help me please!

Greetings!

Help me please.

I have 3 models:

Job hasMany EquipSet
Equip hasMany EquipSet

Job ---> EquipSet <--- Equip

I need to make normal FIND() with associations, automagic, e.t.c.

$query =
SELECT e.img
FROM equips e
WHERE e.id IN ( SELECT e.parent_id
FROM jobs j, equip_sets es, equips
e
WHERE j.id=es.job_id AND
e.id=es.equip_id AND j.id=1
GROUP BY e.parent_id );

$this->Job->EquipSet->Equip->query($query) - it works good


p.s. I am sorry for my English =/

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

No comments: