|
|||||||||||
|
Order in left join
From: Lars Breddemann <larsbr(at)gmx.net>
Date: Wed Aug 01 2007 - 19:15:16 EDT
this is not a bug of MaxDB but a slight confusion about what you're asking the DB to do. You've specified two OUTER joins and defined the table that column is LEFT from the equal sign to be the table where NULLs will be added if fitting values are missing. In this case it may be easier to rewrite the statement into the "oracle"-notation:
select * from "Table1"
select * from "Table1", "Table2"
This means: get me ALL rows from Table2 and fill in NULLs if no fitting row from Table1 is found. Likewise
select * from "Table1"
select * from "Table1", "Table2"
This means: get me ALL rows from Table1 and fill in NULLs if no fitting row from Table2 is found
Unfortunately you made up a testcase where both resultsets are the
same, since there is always one row found and one row to be filled
with NULLs.
If you enter some more data into one of the tables you can easily spot the difference between the two statement:
truncate table "Table2"
Now check again:
select * from "Table1"
still delivers 2 rows while
select * from "Table1"
returns more than 270.000 rows on my (nearly empty) testdb.
So to answer your question:
Best regards,
This archive was generated by hypermail 2.1.8 : Thu Aug 09 2007 - 19:30:28 EDT |
||||||||||
|
|||||||||||