MySQl查询问题

发布于 2024-09-12 20:46:19 字数 1027 浏览 2 评论 0原文

我并没有花太多时间在 MySQL 上,但我被要求调查我的教会网站的问题。它已经停机很长一段时间了,我正在努力让它恢复正常运行。最初的网站是在Mambo 4.5.3中完成的,这是一个旧版本。我会在某个时候升级它,但我只想让它暂时运行。

我目前在使用下面的 Mambo 内置查询时遇到问题。无论站点管理尝试访问页面,我都会收到错误消息:

“on 子句”中存在未知列“c.access”。

我已经验证该列确实存在于指定的表中。现在我很困惑。我打开 MySQL 查询分析器并粘贴查询,我得到了相同的错误消息,代码为 1054。有人有什么想法吗?

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

玩套路吗 2024-09-19 20:46:20
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 
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 
灯角 2024-09-19 20:46:20

错误 1052 消息文本是实际上,%s 中的“foo”列是不明确的。当您连接具有相同名称的列的表并且在不使用表前缀的情况下引用它们时,通常会发生这种情况。

:-?

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.

:-?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文