Re: DB_DataObject: Nested joins possible with joinAdd()?
| From: | Alan Knowles | Date: | Sat, 09 Aug 2003 02:12:18 +0000 |
| Subject: | Re: DB_DataObject: Nested joins possible with joinAdd()? | ||
| References: | 1 | Groups: | php.pear.general php.pear.general |
| Request: | Send a blank email to pear-general+get-7128@lists.php.net to get a copy of this message | ||
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