gpt4 book ai didi

mysql - "in"在此位置无效

转载 作者:行者123 更新时间:2023-11-29 15:35:50 24 4
gpt4 key购买 nike

我不确定 mysql 语句有什么问题。错误提示“IN 在此位置无效,需要:EOF,';'

这是我的sql语句:

 CREATE VIEW collab AS
SELECT a.author_name AS Author, ca.no0fCollab
FROM (SELECT * FROM author) as a, (SELECT * FROM coauthors) as ca
WHERE a.author_id = ca.author_id
AND a.author_id IN (
SELECT UA.author_id
FROM uniq_authored UA JOING publication p
ON P.pubid = UA.pubid
WHERE (p.pubkey LIKE 'journals/%' OR p.pubkey LIKE 'conf/%')
AND p.title LIKE '%data%'
);

最佳答案

不能在 View 中使用 FROM(子查询)
但你不需要......你可以使用连接重构你的查询并避免子查询

  CREATE VIEW collab AS
select a.author_name Author, ca.no0fCollab
FROM author a
INNER JOIN coauthors ca ON a.author_id = ca.author_id
INNER JOIN uniq_authored ua ON a.author_id = ua.author_id
INNER JOIN publication p ON P.pubid = ua.pubid
AND (p.pubkey LIKE 'journals/%' OR p.pubkey LIKE 'conf/%')
AND p.title LIKE '%data%'

关于mysql - "in"在此位置无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58248915/

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