Sunday, October 31, 2010

Joins Question

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

No comments: