MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Egbert Engel Date:August 31 1999 8:21am
Subject:problem with natural joins (version 3.22.21)
View as plain text  
Hi,

>>>>>> Egbert Engel <Egbert.Engel@stripped> wrote:

>> I have a problem when joining two tables (table1, table2)
>> Table 1's primary key column also exists in table2 as "foreign
>> key" column

>>>>>> Michael Widenius <monty@stripped> answered:

> I assume you also know that foreign keys has nothing to do with
> joining tables in a SELECT statement!

Of course. I just thought this was the easiest way to explain want I want to
do.

>> "select * from table1 natural left join table2;"
>> returns the complete result of a regular join, i.e. without
>> using the constraint of two columns with same name.

>> "select * from table2 natural left join table1;"
>> returns the correct result .

The problem was that there were, like in your little example, (almost) no
counterparts in table2.
Maybe I was taken by surprise that I'd expected something different.

>> or maybe I'm too stupid!

Mmmh, looks like I really was.
Thanks,
Egbert
Thread
problem with natural joins (version 3.22.21)Egbert Engel31 Aug