Mysql

令人困惑的 MySql 錯誤

  • October 10, 2013

我正在嘗試在 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')

這是您的查詢:

 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

基本上你對別名感到困惑。我嘗試在上面的程式碼中添加註釋,以幫助您了解設置的時間。

它聞起來有點像您需要導入數據庫模式才能使其正常工作。

引用自:https://serverfault.com/questions/545248