2012-08-11 66 views
0

查詢:在ON子句另一個未知的列名錯誤

SELECT c.title AS title 
      , c.introtext AS body 
      , c.state AS state 
      , c.created AS created 
      , c.created_by AS uid 
      , c.modified AS modified 
      , c.modified_by AS modified_uid 
      , c.published AS published 
      , c.published_by AS published_uid 
      , jos_categories.title AS category 
FROM 
      jos_content AS c, jos_categories 
INNER JOIN jos_categories AS jc 
ON c.sectionid = jc.section 
WHERE c.sectionid = 7 

我相信sectionid柱存在,但我得到的錯誤:

Error Code: 1054. Unknown column 'c.sectionid' in 'on clause' 0.000 sec

我看到這個題目:MySQL unknown column in ON clause但我可以也解決不了。

+0

請確保jos_content表包含列sectionid – 2012-08-11 07:23:39

回答

1

改變你的FROM子句:

FROM jos_content AS c 
INNER JOIN jos_categories AS jc 
ON c.sectionid = jc.section 
WHERE c.sectionid = 7 
0

您瓶坯加入jos_categoriesjos_categories AS jc之間:

jos_content AS c, jos_categories 
INNER JOIN jos_categories AS jc 
ON c.sectionid = jc.section 

cjos_content ...

相關問題