-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
嵌套子查询和join查询报错 #5372
Comments
public Map<FieldItem, List> getRelationTableFields() {
拿着最外层的select字段取最里面一层检查on 条件,真尼玛人才 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Question
表结构
CREATE TABLE
link_user_calss
(id
int(11) NOT NULL,class_id
int(11) DEFAULT NULL,t_id
int(11) DEFAULT NULL,class_honor
varchar(255) DEFAULT NULL,PRIMARY KEY (
id
)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
sql 语句
SELECT
*
FROM
(
SELECT
luc.cid,
luc.classHonor,
b.t_id AS tId
FROM
( SELECT class_id AS cid, GROUP_CONCAT(class_honor ORDER BY class_honor SEPARATOR ';') AS classHonor FROM link_user_calss GROUP BY class_id ) luc
JOIN link_user_calss b ON b.class_id = luc.cid
GROUP BY
luc.cid,
luc.classHonor,
b.t_id
) w
LEFT JOIN link_user_calss lw ON w.tId = lw.t_id
报错
Caused by: java.lang.RuntimeException: com.alibaba.druid.sql.parser.ParserException: parse error. detail message is :
Relation condition column must in select columns.
source sql is :
SELECT * FROM ( SELECT luc.cid, luc.classHonor, b.t_id AS tId FROM ( SELECT class_id AS cid, GROUP_CONCAT(class_honor ORDER BY class_honor SEPARATOR ';') AS classHonor FROM link_user_calss GROUP BY class_id ) luc JOIN link_user_calss b ON b.class_id = luc.cid GROUP BY luc.cid, luc.classHonor, b.t_id ) w LEFT JOIN link_user_calss lw ON w.tId = lw.t_id
at com.alibaba.otter.canal.client.adapter.es.core.ESAdapter.init(ESAdapter.java:91) ~[client-adapter.es7x-1.1.5-jar-with-dependencies.jar:na]
at com.alibaba.otter.canal.client.adapter.es7x.ES7xAdapter.init(ES7xAdapter.java:50) ~[client-adapter.es7x-1.1.5-jar-with-dependencies.jar:na]
... 42 common frames omitted
The text was updated successfully, but these errors were encountered: