I have two tables that I am trying to UNION
. Column id
in table1
is of type STRING
. I do not have that column in table2
so I am writing SELECT NULL AS id FROM table2
but BigQuery thinks that column id
in table2
is of type INT64
.
I get this error -
Column 2 in UNION ALL has incompatible types: STRING, INT64
.
Query works if I write SELECT "" AS id FROM table2
instead.
SELECT id FROM table1 UNION ALL SELECT CAST(NULL AS STRING) FROM table2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With