SELECT * FROM t5 AS table1 LEFT JOIN t1 AS table2 ON table1 .`f11` = table2 .`f1` WHERE table2 .`f6` > 2;
CREATE TABLE p1 AS SELECT table1.f4 AS field1 , table2.f4 AS field2 , table1.f4 AS field3 FROM t3 table1 RIGHT JOIN t4 table2 JOIN t2 table3 ON table2.f6 ON table1.f2 = table3.f2 LEFT JOIN t1 AS table4 ON table3.f2 = table4.f4 WHERE table4.f2 <> 3;
CREATE TABLE p2 AS SELECT table1.f4 AS field1 , table2.f4 AS field2 , table1.f4 AS field3 FROM t3 table1 RIGHT JOIN t4 table2 JOIN t2 table3 ON table2.f6 ON table1.f2 = table3.f2 LEFT JOIN t1 AS table4 ON table3.f2 = table4.f4 WHERE table4.f2 <> 3;
Even simpler test case:
--source include/ have_innodb. inc
CREATE TABLE t1 ( f1 int, f2 int, f4 int, f6 int, PRIMARY KEY (f2), KEY (f6)) ENGINE=InnoDB;
INSERT IGNORE INTO t1 VALUES ('0','4','2','0');
CREATE TABLE t2 (f2 int);
INSERT IGNORE INTO t2 VALUES ('2');
CREATE TABLE t3 (f4 int, f2 int) ;
CREATE TABLE t4 ( f4 int, f6 int) ;
INSERT IGNORE INTO t4 VALUES ('2','6');
CREATE TABLE t5 (f11 int) ENGINE=InnoDB;
SELECT * FROM t5 AS table1 LEFT JOIN t1 AS table2 ON table1 .`f11` = table2 .`f1` WHERE table2 .`f6` > 2;
CREATE TABLE p1 AS SELECT table1.f4 AS field1 , table2.f4 AS field2 , table1.f4 AS field3 FROM t3 table1 RIGHT JOIN t4 table2 JOIN t2 table3 ON table2.f6 ON table1.f2 = table3.f2 LEFT JOIN t1 AS table4 ON table3.f2 = table4.f4 WHERE table4.f2 <> 3;
CREATE TABLE p2 AS SELECT table1.f4 AS field1 , table2.f4 AS field2 , table1.f4 AS field3 FROM t3 table1 RIGHT JOIN t4 table2 JOIN t2 table3 ON table2.f6 ON table1.f2 = table3.f2 LEFT JOIN t1 AS table4 ON table3.f2 = table4.f4 WHERE table4.f2 <> 3;
--let $diff_table_1 = test.p1 diff_tables. inc
--let $diff_table_2 = test.p2
--source include/