本文介绍了混合显式联接和隐式联接失败,并显示“存在表的条目...,但无法从查询的此部分中引用它”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SELECT
      i.*, 
      r.name AS roomname, 
      c.name AS cat, 
      p.key AS imgkey, 
      p.extension AS imgext
   FROM 
      items i, 
      rooms r, 
      categories c 
         LEFT JOIN photos p 
            ON p.referencekey = i.key 
   WHERE 
          i.room = r.key 
      AND r.key = 663308 
      AND i.sitekey = 32201 
      AND c.key = i.categorykey

上述查询在执行时返回以下错误。

The above query when executed returns following error.

第1行:... tegory c左联接照片p ON p.referencekey = i.key位置...

LINE 1: ...tegory c LEFT JOIN photos p ON p.referencekey = i.key WHER...

提示:表 i有一个条目,但是不能从中引用它

HINT: There is an entry for table "i", but it cannot be referenced from this part of the query.


推荐答案

由于您的Items.Room = Rooms.Key,我只是那样

Since your Items.Room = the Rooms.Key, I would just have that as the where..

SELECT
      i.*, 
      r.name AS roomname, 
      c.name AS cat, 
      p.key AS imgkey, 
      p.extension AS imgext
   FROM 
      items i
         LEFT JOIN photos p 
            ON p.referencekey = i.key 
         JOIN rooms r
            on i.room = r.key
         JOIN categories c 
            on i.categorykey = c.key
   WHERE 
          i.sitekey = 32201 
      AND i.room = 663308 

这篇关于混合显式联接和隐式联接失败,并显示“存在表的条目...,但无法从查询的此部分中引用它”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 22:55