gpt4 book ai didi

MySQL Workbench : "SELECT" is not valid at this position for this server version, 期望 : '(' , WITH 错误

转载 作者:行者123 更新时间:2023-11-29 05:47:15 25 4
gpt4 key购买 nike

我在 MySQL Workbench 中编写了以下 SQL 查询:

SELECT
t1.sample_id, t1.v_id, t1.s_type as type, t1.s_fusion, t1.e_fusion, CONCAT(t1.cpt1, ":", t1.ppt1) as point1,
CONCAT(t1.cpt2, ":", t1.ppt2) as point2, t1.s_gene, t1.e_gene, t1.pscore as score, t2.manual_notes
FROM
(
s_samples
WHERE sample_id = 'S0001'
) as t1
INNER JOIN
(
SELECT c.v_id, c.sample_id,
CONCAT(c.sample_id,"(",e.disease,"): ",c.notes) as manual_notes
FROM all_samples e
LEFT JOIN s_samples c
ON e.sample_id=c.sample_id
WHERE c.notes is not null AND c.v_id IN
(SELECT v_id FROM s_samples)
AND c.sample_id = 'S0001'
) as t2
ON t1.v_id = t2.v_id
ORDER BY t1.v_id;

但是,我收到以下错误:“SELECT”在此服务器版本的此位置无效,期望:'(',WITH 错误。我对 SQL 比较陌生,所以我不确定为什么会收到此错误以及如何解决此问题。欢迎提供任何见解。

最佳答案

这不是有效的 SQL:

FROM
(
s_samples
WHERE sample_id = 'S0001'
) as t1

也许你打算:

FROM (SELECT s.*
FROM s_samples s
WHERE s.sample_id = 'S0001'
) t1

当然,这是多余的。您可以只使用该表并将过滤放在外部 WHERE 子句中。

我认为你的错误是由一些普遍的混淆引起的,因为编译器很困惑。

关于MySQL Workbench : "SELECT" is not valid at this position for this server version, 期望 : '(' , WITH 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58757514/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com