2010-06-11 39 views
1

Possible Duplicate:
Was: Not unique table :: Now: #1054 - Unknown column - can't understand why?#1054 - 未知列 - SQL查詢問題

在已經解決的問題,以前與此查詢,我現在堅持收到此錯誤:

1054 - Unknown column 'calendar_events.jobID ' in 'on clause'

我不能undertstand爲什麼...而且這個專欄明目張膽地存在!是否與查詢底部的WHERE等等...部分有關?

SELECT calendar_events.* , 
     calendar_users.doctorOrNurse, 
     calendar_users.passportName, 
     calendar_jobs.destination 
    FROM `calendar_users` , `calendar_events` 
INNER JOIN `calendar_jobs` ON `calendar_events.jobID` = `calendar_jobs.jobID` 
    WHERE `start` >=0 
     AND calendar_users.userID = calendar_events.userID 

任何幫助,將不勝感激!

乾杯

+1

你現在問這個問題的兩倍你這個問題問內太HTTP://計算器。 COM /問題/ 3021429 /是 - 不是唯一的表,現在-1054-未知列着理解,爲什麼 – codingbadger 2010-06-11 09:19:55

回答

2
You should use `calendar_events`.`jobID` instead of `calendar_events.jobID`. 
1

INNER JOIN and , (comma) are semantically equivalent in the absence of a join condition: both produce a Cartesian product between the specified tables (that is, each and every row in the first table is joined to each and every row in the second table).

However, the precedence of the comma operator is less than of INNER JOIN, CROSS JOIN, LEFT JOIN, and so on. If you mix comma joins with the other join types when there is a join condition, an error of the form Unknown column 'col_name' in 'on clause' may occur. Information about dealing with this problem is given later in this section.

來源: http://dev.mysql.com/doc/refman/5.0/en/join.html

希望這有助於