令人困惑的 MySql 错误

令人困惑的 MySql 错误

我正在尝试在 CentOS 上安装一个应用程序,并在我的 apache 日志中看到这个错误。

如果有人能帮助我了解到底是怎么回事,我可以尝试解决该错误。

这是我在日志中看到的内容:

[20131010 16:23][notloggedin]: Database error: Invalid SQL: SELECT  DISTINCT c.name AS category_name, c.acl_id, b.*
           FROM bm_categories c
           INNER JOIN bm_bookmarks b ON c.id = b.category_id
                                         LEFT JOIN go_acl a ON a.acl_id = c.acl_id
           LEFT JOIN go_users_groups ug ON ( a.group_id = ug.group_id ) WHERE
                                         (c.user_id= 0
                                         OR ug.user_id =  0
                                         OR a.user_id =  0) ORDER BY category_name ASC , b.name ASC MySQL Error: 1054 (Unknown column 'c.acl_id' in 'field list')

答案1

这是您的查询:

  SELECT DISTINCT
          c.name AS category_name,
          c.acl_id,  
          b.* 
  FROM
          bm_categories c   <-- An alias is set, and thus "c" means "bm_categories"

  INNER JOIN
          bm_bookmarks b ON c.id = b.category_id  <-- Alias "b" is set for "bm_bookmarks"

  LEFT JOIN
          go_acl a ON a.acl_id = c.acl_id

  LEFT JOIN go_users_groups ug ON ( a.group_id = ug.group_id )

  WHERE
          (c.user_id= 0 OR ug.user_id = 0 OR a.user_id = 0)
  ORDER BY
          category_name ASC, b.name ASC

基本上,您对别名感到困惑。我尝试在上面的代码中注释以帮助您了解何时设置这些别名。

这听起来有点像你需要导入一个数据库模式以便不管是什么上班。

相关内容