Re: join query/relational database question
| From: | Paolo Bonavoglia | Date: | Mon, 06 Jan 2003 21:53:45 +0000 |
| Subject: | Re: join query/relational database question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-24604@lists.php.net to get a copy of this message | ||
At 16:09 06/01/2003 06/01/2003, Doug Parker wrote:
I have a relational database issue that I'll simplify for the sake of this post. [...] So it would be like this:Using SQL the following SELECT should be the solution: SELECT projects.id, company_id, status, company FROM projects, clients WHERE projects.company_id = clients.id You can of course add any other filter in the WHERE clause using the usual AND OR NOT operators. Of course you have to embed this command in an appropriate PhP statement, e.g. using the odbc library, and having an open connection $conn to the DB: odbc_exec($conn, 'SELECT ... '); Hope this will be enough to solve your problem.id | company_id | status | company------------------------------------------------------------------------1 46 Active Jones Inc. 2 54 Inactive Baker Inc.
Paolo BonavogliaCannaregio 3027/R 30121 V E N E Z I A ========================================================
Sito del Liceo Foscarini http://www.liceofoscarini.it/ Astronomia e Calendari http://digilander.iol.it/paolobona/astro/home.html