Hi Inviz,

I think you can make something happen using the "joins" parameter.
I have once been forced to make my own custom find that did some
special joins to get the data I needed.

Below is a thread from a while back where I (hopefully) explain a bit
how the code in the bin works. It wont be copy paste for you but it
should give you some kind of template to do a few tests with to get
something that suits your needs.

http://groups.google.com/group/cake-php/browse_thread/thread/4d3c6aac7cc6f831
http://bin.cakephp.org/view/1729436874

/Martin


On Jan 18, 6:16 pm, Invizibility <[email protected]> wrote:
> Hi all,
>
> I have the following schema:
>
> Jobs HABTM parameters
>
> Parameters table has various columns such as temperature, pressure,
> etc.
>
> The join table jobs_parameters has some additional info called the
> run_time. It gets populated everytime a job is run with a parameter
> set.
>
> eg: Job:
> id      name
> ----------------------
> J1     Job01
> J2     Job02
>
> Parameter:
> id      temperature    pressure
> -------------------------------------------------
> P1     100                101
> P2     150                315
> P3     102                300
>
> jobs_parameters:
> id      job_id   parameter_id run_time
> -----------------------------------------------------
> 1     J1             P1              00:00:00
> 2     J1             P2              17:30:00
> 3     J1             P3              09:30:00
> 4     J2             P2              00:00:00
> 5     J2             P1              12:30:00
> 6     J2             P3              14:30:00
>
> The query is that: Find all jobs that used pressure '101' and '315'
> such that pressure '101' based job run_time was before '315'. Which in
> this case would return J1 only.
>
> I could write a simple query that has two sub queries created by
> joining Parameter and jobs_parameters, and join those two to find the
> result. How would I do this in Cake using find()?
>
> Appreciate all the help and for the great framework.
>
> Thanks,
> Inviz
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to