[英]BigQuery Standard SQL - querying 3 different tables with same schema. How to add column with what table each row is from?
Say I have 3 tables containing clothing brands from - walmart, target, amazon.假设我有 3 个表,其中包含来自沃尔玛、塔吉特、亚马逊的服装品牌。 I make a new table and query * from each table into this new table.
我创建了一个新表并将每个表中的 * 查询到这个新表中。 I want to know which company (walmart, target or amazon) each of these items is from.
我想知道这些商品来自哪家公司(沃尔玛、塔吉特或亚马逊)。 How would I go about doing this in BigQuery?
我 go 如何在 BigQuery 中执行此操作?
Thank you.谢谢你。
Use below approach使用以下方法
select *, 'table1' as source from table1 union all
select *, 'table2' from table2 union all
select *, 'table3' from table3
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.