[英]What is the bigquery sql inner join equivalent for rows?
I have the following 2 tables:我有以下 2 个表:
I would like to create a table where我想创建一个表
The resultant table would like:结果表如下:
There are columns/fields that are common to both tables, but I haven't included them for brevity.有两个表共有的列/字段,但为简洁起见,我没有包括它们。 Basically, I am looking for the equivalent of an inner join operation but then instead of adding the rows of table 2 as columns, add them as rows.
基本上,我正在寻找等效于内部连接操作的方法,但不是将表 2 的行添加为列,而是将它们添加为行。 I have written a sample code whilst experimenting with inner join as below:
我在尝试内部连接时编写了一个示例代码,如下所示:
WITH table_a AS (
SELECT 'x' AS event, 1 AS timestamp, 5 AS endtime, 'a' AS field1
UNION ALL SELECT 'x', 100, 200, 'b'
),
table_b AS (
SELECT 'y' AS event, 2 AS timestamp, 'm' AS field2
UNION ALL SELECT 'y', 25, 'n'
UNION ALL SELECT 'y', 150, 'o'
)
SELECT
table_a.*,
table_b.*
FROM table_a JOIN table_b
Any thoughts what bigquery sql functions I can use?任何想法我可以使用什么 bigquery sql 功能?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.