gpt4 book ai didi

mysql - 子查询错误

转载 作者:行者123 更新时间:2023-11-29 21:48:44 25 4
gpt4 key购买 nike

我无法在下面的 sql 子查询中找到错误。我想要 PublisherWise ImgCount 作为我的输出。请指导我哪里做错了。 TIA。

SELECT pubinfo.mf_pu_id,pubinfo.mf_pu_name, lang.mf_li_name, COUNT(innQ1.mf_cr_fileid) AS Imgcount 
FROM mf_publication_info AS pubinfo
LEFT JOIN
(SELECT mf_cr_fileid,mf_cr_masid,mf_cr_pubid, innQ.`mf_mi_publisheddate`
FROM mf_compare_results
WHERE mf_cr_enginedecision='p'AND mf_cr_userdecision IN('M',' M',' EM','EM')
INNER JOIN
(SELECT mf_mi_id,mf_mi_publisheddate
FROM mf_media_info
WHERE mf_mi_publisheddate BETWEEN '2015-07-27' AND
'2015-07-31' AND `mf_mi_processid`=16
) AS innQ
) AS innQ1
ON innQ1.mf_cr_fileid=innQ.mf_mi_id
ON pubinfo.mf_pu_id=innQ1.mf_cr_pubid
INNER JOIN mf_language_info lang
ON pubinfo.mf_pu_langid = lang.mf_li_id
GROUP BY pubinfo.mf_pu_name ORDER BY pubinfo.mf_pu_name

最佳答案

这有以下两种解释,(我认为),如果我错了,请纠正我。

示例1:

SELECT x
FROM table 1
LEFT JOIN (sub 1) alias ON x=x
INNER JOIN (sub 2) alias ON x=x
INNER JOIN table 2 ON x=x
GROUP BY x
ORDER BY x

示例2:

SELECT x
FROM table 1
LEFT JOIN (
(sub 1) alias
INNER JOIN
(sub 2) alias ON x=x
) alias ON x=x
INNER JOIN table 2 ON x=x
GROUP BY x
ORDER BY x

如果是第二个(这对我来说有意义),那么您需要第一个子查询的别名和第一个左连接处的开括号以及第一个内连接子查询的 ON 条件。

请写下,因为我对您要写的内容有一个非常简化的版本,这样应该更有意义。

关于mysql - 子查询错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33868493/

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