【问题标题】:Duplicate column names in the result are not supported in BigQueryBigQuery 不支持结果中的重复列名称
【发布时间】:2019-09-17 23:13:40
【问题描述】:

我正在尝试在 BQ 中选择一些列并收到有关重复 ID 的投诉:

Duplicate column names in the result are not supported. Found duplicate(s): id

我使用的查询是:

SELECT
  billing_account_id,service.id,service.description,sku.id
FROM `billing-management-edab.billing_dataset.gcp_billing_export_v1_blah_blah_blah`

为什么 service.id 和 sku.id 被认为是重复的?我怎样才能在我的查询中解决这个问题?

【问题讨论】:

    标签: google-bigquery


    【解决方案1】:

    为两个id 列指定别名:

    SELECT
        billing_account_id,
        service.id AS service_id,
        service.description,
        sku.id AS sku_id
    FROM `billing-management-edab.billing_dataset.gcp_billing_export_v1_blah_blah_blah`
    

    实际上,您可能遗漏了部分查询,特别是其他表,它们本身被别名为servicesku。但无论如何,将您的 select 子句中的两个 id 列中的每一个都指定为不同的别名应该可以解决您的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-19
      • 1970-01-01
      相关资源
      最近更新 更多