此查询和子查询有什么问题?

时间:2019-06-13 05:10:20

标签: mysql

此查询出了什么问题? 下面是查询和出现的错误。

  

“ IN / ALL / ANY子查询”中的未知列“ p.custidd”

SELECT DISTINCT( p.pid ),
               p.parentid,
               p.title,
               p.custid,
               p.totalshares,
               p.totalreplies,
               p.filetype,
               p.filename,
               p.reactions,
               p.sdate,
               c.custid,
               pr.username,
               pr.img,
               pr.signature
FROM   posts_forum AS p,
       profiles_forum AS pr,
       customer_forum AS c,
       posts_to_tags_forum AS p2t,
       customer_tags_forum AS c2t,
       block_forum AS b
WHERE  c.stat = 'y'
       AND c2t.custid = '1'
       AND p2t.pid = p.pid
       AND p2t.tag = c2t.tag
       AND p.custid = c.custid
       AND pr.custid = p.custid
       AND p.custidd NOT IN (SELECT profileid AS custid
                             FROM   block_forum AS b,
                                    posts_forum AS p
                             WHERE  b.custid = '1')
ORDER  BY p.sdate DESC
LIMIT  0, 25  

1 个答案:

答案 0 :(得分:0)

看来您有错字:

AND p.custidd NOT IN (SELECT profileid AS custid
                         FROM   block_forum AS b,
                                posts_forum AS p
                         WHERE  b.custid = '1')

其中p.custidd可能是p.custid