1

I don't spend a whole lot of time in MySQL, but I have been asked to look into a problem with my church's website. It has been down for quite some time and I am trying to get it back up and running. The original site was done in Mambo 4.5.3, which is an old version. I will upgrade it at some point, but I just want to get it running for the time being.

I am currently having a problem with the Mambo built in query below. Wherever the site administration tries to access pages, I get the error message:

Unknown column 'c.access' in 'on clause'.

I have verified that the column does exist in the specified table. Now I am stumped. I opened up the MySQL Query analyzer and pasted the query in and I get the same error message with code 1054. Does anyone have any ideas?

SELECT 
    c.*, 
    g.name AS groupname, 
    cc.name, 
    u.name AS editor, 
    f.content_id AS frontpage, 
    s.title AS section_name, 
    v.name AS author 
FROM 
    mos_content AS c, 
    mos_categories AS cc, 
    mos_sections AS s 
    LEFT JOIN mos_groups AS g ON g.id = c.access 
    LEFT JOIN mos_users AS u ON u.id = c.checked_out 
    LEFT JOIN mos_users AS v ON v.id = c.created_by 
    LEFT JOIN mos_content_frontpage AS f ON f.content_id = c.id 
WHERE 
    c.state >= 0 
    AND c.catid=cc.id 
    AND cc.section=s.id 
    AND s.scope='content' 
ORDER BY 
    s.title, 
    c.catid, 
    cc.ordering, 
    cc.title, 
    c.ordering 
LIMIT 
    0,10
2
  • so you're sure theres a column named 'access' in the MOS_CONTENT table? Commented Aug 3, 2010 at 18:13
  • The table mos_content should have the access column, i think there's no other reason to get that error Commented Aug 3, 2010 at 18:14

2 Answers 2

5
SELECT  
    c.*,  
    g.name AS groupname,  
    cc.name,  
    u.name AS editor,  
    f.content_id AS frontpage,  
    s.title AS section_name,  
    v.name AS author  
FROM  
    mos_content AS c 
    INNER JOIN mos_categories AS cc on c.catid=cc.id  
    INNER JOIN mos_sections AS s on cc.section=s.id 
    LEFT JOIN mos_groups AS g ON g.id = c.access  
    LEFT JOIN mos_users AS u ON u.id = c.checked_out  
    LEFT JOIN mos_users AS v ON v.id = c.created_by  
    LEFT JOIN mos_content_frontpage AS f ON f.content_id = c.id  
WHERE  
    c.state >= 0  
    AND s.scope='content'  
ORDER BY  
    s.title,  
    c.catid,  
    cc.ordering,  
    cc.title,  
    c.ordering  
LIMIT  
    0,10 
Sign up to request clarification or add additional context in comments.

Comments

0

The error 1052 message text is actually something like Column 'foo' in %s is ambiguous. It normally happens when you join tables that have columns with the same name and you refer to them without the table prefix.

:-?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.