Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2001072

[PHP-DB] Re: A Join Question From: Hugh Bothwell (hugh_bothwell <email protected>)
Date: 07/30/01

"Steve Fitzgerald" <sf <email protected>> wrote in message
news:20010730141456.85883.qmail <email protected>
> I'm trying to create a join statement that pulls out a CompanyName based
> on a given CompanyID that is tied to a specified ContactID.
>
> For example, if ContactID=1 then the corresponding CompanyName might be
> Smith, Inc. depending on what was entered.

SELECT
    CompanyName
FROM
        Company
    INNER JOIN
        Contacts
    ON
        Company.CompanyID = Contacts.CompanyID
WHERE
    ContactID=$ContactID

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>