对于每个目标行,BigQuery-UPDATE中的SQL最多只能匹配一个源行
我正在try 使用表B中具有相同列名的数据将数据写入到表A中的"垂直"列,这是基于表A中的"查询"列和表B中的"关键字"列之间的匹配.问题是:TableA有多个行具有相同的匹配项(示例数据如下所示).
我收到的错误消息是
对于每个目标行,更新/合并最多只能匹配一个源行
这是我目前正在运行的查询:
UPDATE `tableA` AS tA
SET tA.vertical = tB.vertical
FROM `tableB` AS tB
WHERE tA.query = tB.keyword;
这些是表A和表B的样本.
tableA个
query | unique_key | vertical |
---|---|---|
abc | 123456 | null |
abc | 789abc | null |
abc | defghi | null |
def | 5l5p5p | null |
def | qwertz | null |
def | m43222 | null |
tableB个
keyword | vertical |
---|---|
abc | planet |
def | earth |
这就是我在运行查询后期望的TableA:
Updated tableA个
query | unique_key | vertical |
---|---|---|
abc | 123456 | planet |
abc | 789abc | planet |
abc | defghi | planet |
def | 5l5p5p | earth |
def | qwertz | earth |
def | m43222 | earth |
任何支持都是非常感谢的.