adding join conditions with DB_DataObject
| From: | Ian P. Christian | Date: | Fri, 04 Feb 2005 15:34:45 +0000 |
| Subject: | adding join conditions with DB_DataObject | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-17384@lists.php.net to get a copy of this message | ||
I'm currently struggling to achive this query with DB_DataObject:
SELECT raduser.* , radreply.Value as ip FROM raduser LEFT JOIN radreply AS
radreply ON radreply.UserName=raduser.username AND Attribute =
"Framed-IP-Address" WHERE raduser.customerId LIKE "%MAS02%";
Notice multiple join contitions.
DB_DataObject::debugLevel(2);
$do =& DB_DataObject::factory('raduser');
$do1 =& DB_DataObject::factory('radreply');
$do->joinAdd($do1, "LEFT", 'radreply',
'radreply.UserName=raduser.username AND
Attribute = "Framed-IP-Address"');
Results in :
dataobjects_raduser: ERROR: joinAdd: You cannot target a join column in the
'link from' table (radreply). Either remove the fourth argument to joinAdd()
(radreply.UserName=raduser.username AND Attribute = "Framed-IP-Address"), or
alter your links.ini file.
Nice to see an imrovement in the linking error messages there btw ;)
Useful error, and I nnderstand it, but i'm not trying to join here on a
table1.column = table2.column style.
Can anyone suggest a way I can achive this?
Kind Regards.
--
Ian P. Christian
http://pookey.co.uk