Bug Report
Please answer these questions before submitting your issue. Thanks!
- What did you do?
If possible, provide a recipe for reproducing the error.
CREATE TABLE table1 (
id int(0) DEFAULT NULL,
name varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE table2 (
id int(0) DEFAULT NULL,
name varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into table1(id ,name) values(1,'a');
insert into table2(id ,name) values(1,'a');
select t1.id as i1,t2.id as i2,t3.id as i3
from (select tt.id,tt.name from (select id,name from table1) tt) as t1
LEFT JOIN table1 t2 on t1.name = t2.name
LEFT JOIN table2 t3 on t1.name = t3.name;
select * from temp_v;
- What did you expect to see?
------+------+------+
| i1 | i2 | i3 |
+------+------+------+
| 1 | 1 | 1 |
+------+------+------+
- What did you see instead?
You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 103 near "AS t1 LEFT JOIN test.table1 AS t2 ON t1.name=t2.name) LEFT JOIN test.table2 AS t3 ON t1.name=t3.name"
- What version of TiDB SQL Parser are you using?
master
Bug Report
Please answer these questions before submitting your issue. Thanks!
If possible, provide a recipe for reproducing the error.
CREATE TABLE table1 (
id int(0) DEFAULT NULL,
name varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE table2 (
id int(0) DEFAULT NULL,
name varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into table1(id ,name) values(1,'a');
insert into table2(id ,name) values(1,'a');
select t1.id as i1,t2.id as i2,t3.id as i3
from (select tt.id,tt.name from (select id,name from table1) tt) as t1
LEFT JOIN table1 t2 on t1.name = t2.name
LEFT JOIN table2 t3 on t1.name = t3.name;
select * from temp_v;
------+------+------+
| i1 | i2 | i3 |
+------+------+------+
| 1 | 1 | 1 |
+------+------+------+
You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 103 near "AS
t1LEFT JOINtest.table1ASt2ONt1.name=t2.name) LEFT JOINtest.table2ASt3ONt1.name=t3.name"master