【问题标题】:My Big Query Join isn't returning columns from the second table我的 Big Query Join 没有从第二个表返回列
【发布时间】:2021-08-05 11:05:59
【问题描述】:

这真的让我很烦,我想不通。首先,我是使用 BigQuery 的新手,这是我第一次尝试并排组合两个表。发生的事情是查询运行正常,但它没有返回第二个表中的列。请帮忙。

SELECT
    countryName,
    accountName,
    query as SearchTerm,
    CAST(reportDate AS DATE) AS reportDate,
    campaignName,
    campaignId,
    adGroupName,
    adGroupId,
    keywordId,
    keywordText,
    matchType,
    impressions,
    clicks,
    cost,
    attributedConversions7d as Conversions,
    attributedUnitsOrdered7d as Orders,
    attributedSales7d as Sales

   FROM
    `bold-tooling-306614.Nexus_Big_Query.Amazon_Ads_KeywordReports_1500862413536214_SponsoredProducts_SearchTermKeywordReport` b

    LEFT OUTER JOIN `bold-tooling-306614.Nexus_Big_Query.Branded List` s
    ON b.query = s.Customer_Search_Term
    where b.accountName="XeroShoes"

【问题讨论】:

    标签: join google-bigquery left-join outer-join


    【解决方案1】:

    我不知道第二个表的内容和您期望的字段。最简单的解决方案是在所有投影字段(在 SELECT 中)前面加上它们来自的表。

    SELECT b.fieldFromTableFrom, s.fieldFromTableJoin ...
    

    您也可以设置s.*查看所有字段。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-10-21
      • 1970-01-01
      • 1970-01-01
      • 2013-02-28
      • 1970-01-01
      • 2013-12-24
      • 1970-01-01
      相关资源
      最近更新 更多