List:General Discussion« Previous MessageNext Message »
From:Christian Mack Date:June 8 1999 11:13am
Subject:Re: Joining tables
View as plain text  
Roger Smith wrote:
> 
> Hey all, I have a db with many tables and each table has this field
> "machine_id" as a field.  I have the following statement:
> 
> $query = "SELECT * FROM birth,physical,deployment
>          WHERE( ($machine_id = birth.machine_id) OR
>                 ($machine_id=physical.machine_id) OR ($machine_id =
>                 deployment.machine_id))";
> and this doesn't return any information if the birth table had information
> in it but the physical table doesn't and the deployment table doesn't.
> Can you tell me what I am doing wrong and how I may correct it, thanks.
> 
> Roger R. Smith

Hi Roger

You must have at least one row in each of the tables to get out something, or you have to
use LEFT JOIN instead.

Tschau
Christian

Thread
Joining tablesRoger Smith7 Jun
  • Re: Joining tablesSasha Pachev8 Jun
    • MySQL vs DB2Richard McLean12 Jun
      • Re: MySQL vs DB2Tani Hosokawa12 Jun
        • Re: MySQL vs DB2Richard McLean12 Jun
          • Re: MySQL vs DB2Tani Hosokawa12 Jun
            • Re: MySQL vs DB2Michael Widenius12 Jun
              • Re: MySQL vs DB2Luuk de Boer15 Jun
        • Re: MySQL vs DB2Michael Widenius12 Jun
          • Re: MySQL vs DB2Tani Hosokawa12 Jun
            • Comment on "MySQL == not transaction-based" (was: Re: MySQL vs DB2)Jason Haar16 Jun
              • Re: Comment on "MySQL == not transaction-based" (was: Re: MySQL vs DB2)Sasha Pachev16 Jun
  • Re: Joining tablesChristian Mack8 Jun