Re: DB_Dataobject and complex joins

From: Date: Mon, 05 Dec 2005 21:03:17 +0000
Subject: Re: DB_Dataobject and complex joins
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22156@lists.php.net to get a copy of this message
On 12/5/05, Hugo W. Alves <hwalves@yahoo.com.br> wrote: > Hi People! > > How I do this using DB_DataObject functions? > > select * > from table1 as a > left join table2 as b > on a.field1 = b.field1 and a.field2 = b.field2 and a.field3 = b.field3 > > my db.links.ini: > > [table1] > field1 = table2:field1 > field2 = table2:field2 > field3 = table2:field3 > > the call: > > $F = DB_DataObject::factory('table1'); > $C = DB_DataObject::factory('table2'); > $F->joinAdd($C); > $F->find(); > > the query result: > > SELECT * FROM table1 INNER JOIN table2 ON table1.field1=table2.field1 > > Where are the others releted fields? > DB_DO only supports single column foreign keys. In DB_DO's eyes table1 has 3 seperate links to table2 the way that you set it up. -- Justin Patrin

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