2017-07-10 73 views
0

我在進行內部連接時引用兩列時遇到了問題。我嘗試了以下組合無濟於事。內部連接參考

SELECT 
* 
FROM 
adwords_final 
INNER JOIN mk_kw ON adwords_final.Key = mk_kw.Key; 

SELECT 
* 
FROM 
adwords_final 
INNER JOIN mk_kw ON "adwords_final.Key" = "mk_kw.Key"; 

導致以下或類似情況。

ERROR: column adwords_final.key does not exist 
LINE 5: INNER JOIN mk_kw ON adwords_final.Key = mk_kw.Key; 
         ^
HINT: Perhaps you meant to reference the column "adwords_final.Key". 
********** Error ********** 

ERROR: column adwords_final.key does not exist 
SQL state: 42703 
Hint: Perhaps you meant to reference the column "adwords_final.Key". 
Character: 49 

在我看來,我失去了一些更明顯的東西。我是否需要進一步參考後者或完全創建新的查詢?

謝謝

adwords in adwords final; mk_kw

​​

回答

1

的標識符的每一個元素需要內

Week Keyword state Keyword Campaign Ad group Status Max. CPC Impressions Interactions Interaction Types Interaction Rate Avg. Cost Cost Clicks Avg. position Conversions Quality score Ad relevance Landing page experience Expected clickthrough rate Qual. score (hist.) Ad relevance (hist.) Landing page experience (hist.) Expected clickthrough rate (hist.) Search Impr. share Match type First position CPC Top of page CPC First page CPC Impressions with average ctr Impressions with above average ctr Impressions with below average ctr Impressions with below average lp exp Impressions with average lp exp Impressions with above average lp exp Impressions with below average Ad Rel Impressions with average ad rel Impressions with above average ad rel QSxIMP Key 

列被包括在雙引號。不是完整的標識符。

所以你需要使用:的

"adwords_final"."Key",而不是"adwords_final.Key"

"mk_kw"."Key",而不是"mk_kw.Key"

注意,都是小寫標識符不需要被引用。 "mk_kw"."Key"相同mk_kw."Key"


對於一個完整的描述,請參閱手冊中的一章Identifiers and Key Words