作爲Google BigQuery平臺的初學者,我發現它與它的語法幾乎類似於MySql。但是,我收到一個問題,在我的查詢中沒有在我正在執行的Inner Join的任一側找到一列。「錯誤:在JOIN的任一側都找不到字段'[編輯] .field_id'」,Google BigQuery
以下示例查詢:
SELECT
base_account.random_table_name_transaction.context_id,
base_account.random_table_name_transaction.transaction_id,
base_account.random_table_name_transaction.meta_recordDate,
base_account.random_table_name_transaction.transaction_total,
base_account.random_table_name_transaction.view_id,
base_account.random_table_name_view.user_id,
base_account.random_table_name_view.view_id,
base_account.random_table_name_view.new_vs_returning,
base_account.random_table_name_experience.view_id,
base_account.random_table_name_experience.experienceId,
base_account.random_table_name_experience.experienceName,
base_account.random_table_name_experience.variationName,
base_account.random_table_name_experience.iterationId,
base_account.random_table_name_experience.isControl
FROM
[base_account.random_table_name_transaction] transactiontable
INNER JOIN
base_account.random_table_name_view viewtable
ON
transactiontable.view_id=viewtable.view_id
INNER JOIN
[base_account.random_table_name_experience] experiencetable
ON
viewtable.view_id=experiencetable.view_id
WHERE experiencetable.experienceId = 96659 or experiencetable.experienceId = 96660
在這種情況下,當我的BigQuery平臺內運行,查詢運行的幾秒鐘後,我返回了一個錯誤: "Error: Field 'base_account.random_table_name_experience.experienceId' not found on either side of the JOIN"
。
但是,當我運行相同的查詢但是我執行SELECT *
查詢時,它確實執行並返回我期望的數據。
我的語法有些缺失,爲什麼它失敗?我可以確認每個列我都試圖返回確實存在於每個受尊敬的表中。
@ eliot-brossard我添加了你的修復程序,並且返回了'「在SQL查詢中無法引用傳統SQL視圖。」' – reid
聽起來你需要改變視圖定義以使用標準SQL那種情況。您可以閱讀[遷移指南](https://cloud.google.com/bigquery/docs/reference/standard-sql/migrating-from-legacy-sql#logical_views)中的相關建議。 –