Skip to content
Advertisement

Duplicate column names in BigQuery when selecting twice within the same table

I am trying to perform the following query in BigQuery:

It is basically a selection on the same table applying different condition rules, with the aim to then create a view. However, I get the following error: Duplicate column names in the result are not supported. Found duplicate(s): date

Do you have any idea about how to fix this?

Advertisement

Answer

Mainly, your SELECT * will just get all columns from TAB_1 and TAB_2, and in both cases, you have the date field.

In your case, your join condition is an equality, but if you wanted to get the date from TAB_2 as well in your results, or if you want to get all columns from TAB_2, whatever they are, you could do something like

SELECT TAB_1.*, TAB_2.* EXCEPT(date), TAB_2.date AS tab_2_date FROM ...

edit: To help you with the FULL JOIN question.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement