RE: [PEAR] Re: DB_DataObject: Nested joins possible with joinAdd()?
| From: | Andy Crain | Date: | Sat, 09 Aug 2003 17:51:42 +0000 |
| Subject: | RE: [PEAR] Re: DB_DataObject: Nested joins possible with joinAdd()? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7138@lists.php.net to get a copy of this message | ||
Alan,
Thanks. Unfortunately, I have to link b to a and c to b, rather than
both c and b to a. So I went ahead and used query() and it works great.
Thanks,
Andy
> -----Original Message-----
> From: Alan Knowles [mailto:alan@akbkhome.com]
> Sent: Friday, August 08, 2003 10:12 PM
> To: pear-general@lists.php.net; Andy Crain
> Cc: pear-general@lists.php.net
> Subject: [PEAR] Re: DB_DataObject: Nested joins possible with
joinAdd()?
>
> This kind of works with postgres, as it has nested queries.. - but
I've
> no idea if it even possible in mysql.
>
> $tablea->joinAdd($tableb);
> $tablec->joinAdd($tablea);
>
> I suspect the logic to do all this properly may be too much for the
> joinAdd method.. - and resorting to query would probably be the best
> answer for these rather complex operations
>
> I used to have a stronger warning.. - but this is still on the joinAdd
> manual Page..
>
> . "Be careful when using this, raw queries may be clearer than using
> joinAdd."
>
> Regards
> Alan
>
>
> Andy Crain wrote:
> > It seems to me that it's not possible to construct nested or chained
> > joins with joinAdd(). That is, something like:
> >
> >
> >
> > select stuff
> >
> > from table_a
> >
> > left join table_b on table_a.b_id = table_b.b_id
> >
> > left join table_c on table_b.c_id = table_c.c_id
> >
> >
> >
> > I can't come up with a way to do this using joinAdd(), since it
seems
> > one of the joined tables always must be the current object, and in
this
> > example, neither of the tables in the second join is the current
> > table/object calling joinAdd(), in this case DataObjects_Table_a.
Will I
> > have to use query() for this? Just wanted to check with those more
> > knowledgeable than me before giving up.
> >
> >
> >
> > Thanks in advance,
> >
> > Andy
> >
> >
>
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php