RE: [PHP] collapse SELECT from multiple tables

From: Date: Thu, 24 Mar 2005 19:24:27 +0000
Subject: RE: [PHP] collapse SELECT from multiple tables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-211497@lists.php.net to get a copy of this message
Your example doesn't produce the desired the results! The reason I posted to the PHP list was I thought I would have to apply some ARRAY functions to produce the output I'm looking for. Your example did nothing more than mine produced. On Thu, 2005-03-24 at 12:48 -0600, Jay Blanchard wrote: > [snip] > I'm trying to figure out the best way to handle a SELECT from multiple > tables where a single ID in tableA relates to multiple ID's in tableB: > > "SELECT tableA.ID, tableB.data FROM tableA, tableB WHERE tableA.ID=3 AND > tableA.ID=tableB.tableAID" > > What I'm trying to product is an array output similar to: > > | ID | data | > | 3 | data1, data2, data3 | > [/snip] > > SELECT a.foo, b.foobar > FROM tableA a LEFT OUTER JOIN tableB b > ON(a.id = b.id) > > SELECT p.users > FROM php.list p LEFT OUTER JOIN mysql.list m > ON (p.phpuserid = m.mysqluserid) > GROUP BY p.users > HAVING clue > 0;

« previous php.general (#211497) next »