use test; --disable_warnings drop table if exists t1, t2; --enable_warnings create table t1 ( a int primary key, b varchar(30) ) ENGINE = ndb ; insert into t1 values (1,'one'); insert into t1 values (2,'two'); insert into t1 values (3,'three'); insert into t1 values (4,'four'); commit ; select a,b from t1 ; create table t2 ( a int primary key, b varchar(30) ) ENGINE = myisam ; insert into t2 values (1,'one'); insert into t2 values (2,'two'); insert into t2 values (3,'three'); insert into t2 values (4,'four'); commit ; select a,b from t2 ; ######## correlated subqueries #!!!! wrong result select a, b FROM t1 outer_table where a = (select a from t1 where b = outer_table.b ) ; # correct result select a, b FROM t1 outer_table where a = (select a from t2 where b = outer_table.b ) ; #!!!! wrong result select a, b FROM t2 outer_table where a = (select a from t1 where b = outer_table.b ) ; # correct result select a, b FROM t2 outer_table where a = (select a from t2 where b = outer_table.b ) ; drop table t1, t2 ;