Sunday, October 31, 2010

Re: Joins Question

Hi Dave,

Use this condition where B.a_id!=C.a_id

Enjoy,

Amit

On Sun, Oct 31, 2010 at 6:23 PM, Dave Maharaj <me@davemaharaj.com> wrote:

Can anyone help me with a join that looks like this. Or if it is even possible…..

 

ModelA hasMany ModelB, ModelC

Model B and ModelC belongto ModelA

 

So ModelB is related by a_id and ModelC by a_id pretty standard stuff.

 

So records in B or C are optional and can be in both B and C or none or eiter one, but if in C then exclude it from the record…..nasty.

 

So get all A records when in B.a_id but not if also in C.a_id (never get B.a_id if its also in C.a_id)

 

Please no contain answers as that's what I am doing now but because of getting empty array keys and unsetting and paging I would like to see if the joins would be best.

 

Thanks guys.

 

Dave

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
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

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
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: