bluethundr
bluethundr

Reputation: 1345

Duplicate column names in the result are not supported in BigQuery

I'm trying to select some columns in BQ and getting a complaint about duplicate IDs:

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

The query I'm using is:

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

Why are service.id and sku.id considered duplicates? And how can I get around that in my query?

Upvotes: 2

Views: 5265

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 522741

Give aliases to the two id columns:

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`

Actually, you may have left out part of your query, in particular the other table(s) which themselves were aliased as service and sku. But in any case, giving each of the two id columns in your select clause as a distinct alias should resolve your error.

Upvotes: 4

Related Questions