Re: DB_Dataobject and complex joins

From: Date: Wed, 19 May 2004 17:20:32 +0000
Subject: Re: DB_Dataobject and complex joins
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12629@lists.php.net to get a copy of this message
The only way to do that is really to manually set the _join string - probably in a method function buildRadCheckJoin() { $this->_join = "LEFT JOIN radcheck ON radcheck.UserName=radacct.UserName AND radcheck.Attribute = 'Password' "; } Regards Alan Ian P. Christian wrote:
Quoting Alan Knowles <alan@akbkhome.com>:
$radUser =& DB_DataObject::factory('Radacct'); $radCheck =& DB_DataObject::factory('Radcheck');
     $radCheck->Attribute = 'Password';
$radUser->joinAdd($radCheck, 'LEFT', 'radcheck');
'should' Do it...
I tried this :) Perhaps I should have mentioned that in my first email. The result of that is as follows: SELECT count(radacct.RadAcctId) as DATAOBJECT_NUM FROM radacct LEFT JOIN radcheck ON radcheck.UserName=radacct.UserName WHERE radcheck.Attribute = 'Password' This actually gives different results from this. (which is what I'm after) SELECT * FROM radacct LEFT JOIN radcheck ON radcheck.Username = radacct.Username AND radcheck.Attribute = 'Password' Notice the last of the WHERE clause. Thanks for your help again AK! Kind Regards, Ian


« previous php.pear.general (#12629) next »