0

Query:

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

I am sure that sectionid column exists, but I am getting error:

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

I saw this topic: MySQL unknown column in ON clause but I can't solve it too.

Community
  • 1
  • 1
keram
  • 2,321
  • 4
  • 24
  • 29

2 Answers2

1

change your FROM clause to:

FROM   jos_content AS c
INNER JOIN jos_categories AS jc 
ON c.sectionid = jc.section 
WHERE c.sectionid = 7 
Joe G Joseph
  • 23,518
  • 5
  • 56
  • 58
0

You preform the join between jos_categories and jos_categories AS jc:

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

but c is jos_content...

Nir Alfasi
  • 53,191
  • 11
  • 86
  • 129