List:Cluster« Previous MessageNext Message »
From:Dmitry Rojkov Date:November 2 2004 3:32pm
Subject:Strange behaviour of LEFT JOIN
View as plain text  
Hi,

I'm testing MySQL cluster (4.1.6-gamma-nightly-20041013).

I see that LEFT JOIN doesn't always work as I expect.
For example...
There are 2 tables: test1 and test2.

CREATE TABLE `test1` (
  `SubscrID` int(11) NOT NULL auto_increment,
  `UsrID` int(11) NOT NULL default '0',
  PRIMARY KEY  (`SubscrID`),
  KEY `idx_usrid` (`UsrID`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;

INSERT INTO `test1` VALUES (2,224),(3,224),(1,224);

CREATE TABLE `test2` (
  `SbclID` int(11) NOT NULL auto_increment,
  `SbcrID` int(11) NOT NULL default '0',
  PRIMARY KEY  (`SbclID`),
  KEY `idx_sbcrid` (`SbcrID`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;

INSERT INTO `test2` VALUES (3,2),(1,1),(2,1),(4,2);

The query
SELECT s.SubscrID,l.SbclID FROM test1 s left JOIN test2 l ON 
l.SbcrID=s.SubscrID WHERE s.UsrID=224;

shows the result
+----------+--------+
| SubscrID | SbclID |
+----------+--------+
|        3 |   NULL |
|        1 |   NULL |
|        2 |   NULL |
+----------+--------+
Looks like there are no corresponding rows in the table test2

But if I use the MyISAM engine the result is
+----------+--------+
| SubscrID | SbclID |
+----------+--------+
|        1 |      1 |
|        1 |      2 |
|        2 |      3 |
|        2 |      4 |
|        3 |   NULL |
+----------+--------+

I can't find notes in the changelog that this issue was solved in the 
current release.

Thread
Strange behaviour of LEFT JOINDmitry Rojkov2 Nov
  • Re: Strange behaviour of LEFT JOINPh.D. Joseph E. Sacco2 Nov
    • Re: Strange behaviour of LEFT JOINDmitry Rojkov3 Nov
      • Re: Strange behaviour of LEFT JOINPh.D. Joseph E. Sacco3 Nov
        • Re: Strange behaviour of LEFT JOINDmitry Rojkov4 Nov
          • Re: Strange behaviour of LEFT JOINTomas Ulin4 Nov
            • Re: Strange behaviour of LEFT JOINJonas Oreland8 Nov