List:General Discussion« Previous MessageNext Message »
From:Rhino Date:December 11 2004 9:47pm
Subject:Re: Strange results
View as plain text  
----- Original Message ----- 
From: "Steve Grosz" <boise_bound@stripped>
To: <mysql@stripped>
Sent: Saturday, December 11, 2004 3:57 PM
Subject: Strange results

> I'm curious, why if I enter this code:
> select *
> from vendor
> left outer join model
> on vendor.PID=model.VendorID
> left outer join specs
> on model.Model=specs.ProdModel
> where vendor.Vendor='#URL.Vendor#'
> do I get the results like:
> I simply want 1 row for each product to be displayed, not 4 sets of 4
It's hard to say for sure without seeing your table definitions and a
sampling of the data in each table but I think there's a very good chance
that either one of your tables doesn't have a primary key defined or that
you are not joining on the primary key in one of your joins.

Joins typically take place between a primary key on one table and a
corresponding foreign key on the other table. The syntax of your joins seems
fine so I can only suspect the two things I said above. For instance, if
Vendor.PID is intended to be unique and you think of it as the primary key
but it hasn't actually been defined that way in the table, it's very
possible that this is causing your duplicate rows.


Strange resultsSteve Grosz11 Dec
  • Re: Strange resultsRhino11 Dec
    • Re: Strange resultsSteve Grosz11 Dec
      • Re: Strange resultsKevin A. Burton11 Dec
  • Re: Strange resultsSteve Grosz11 Dec