join query/relational database question
| From: | Doug Parker | Date: | Mon, 06 Jan 2003 21:09:39 +0000 |
| Subject: | join query/relational database question | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-24603@lists.php.net to get a copy of this message | ||
I have a relational database issue that I'll simplify for the sake of this post. I have one table, called clients, that has an id and the company name. For example:
id | company
-----------------------
46 Jones Inc.
54 Baker Inc.
etc.
I have another table called projects, that looks like this:
id | company_id | status
-----------------------------------------------
1 46 Active
2 54 Inactive
etc.
In this case, it is relational in that company_id is the key to the clients table, for naming purposes. My question is, is it possible to do a query across two tables that could retrieve all of the information in the projects table AND have the 'company' field in the clients table come up as well. So it would be like this:
id | company_id | status | company
------------------------------------------------------------------------
1 46 Active Jones Inc.
2 54 Inactive Baker Inc.
any help would be greatly appreciated...