UPDATE / MERGE必须与每个目标行Bigquery最多匹配一个源行

时间:2019-02-14 20:17:30

标签: sql google-bigquery legacy-sql

尝试更新bigquery中的表,但收到一条错误消息,指出

“ UPDATE / MERGE必须与每个目标行最多匹配一个源行”

  update Data_Layer.ClassCategories cc
  set cc.MovmentTypeId = t.MovementTypeId,
  cc.IntensityId = t.IntensityId
  FROM
  AloomaTest.testfile t
   where cc.CategoryId  = t.CategoryId 

然后我尝试了该查询

update Data_Layer.ClassCategories cc
set cc.MovmentTypeId = (select MovementTypeId from AloomaTest.testfile t 
where cc.CategoryId  = t.CategoryId ), 
cc.IntensityId = (select IntensityId from AloomaTest.testfile t where 
cc.CategoryId  = t.CategoryId )
where cc.CategoryId IN ( select CategoryId from AloomaTest.testfile)

得到此错误错误:标量子查询产生了多个元素

测试文件的样本数据 enter image description here

分类类别的样本数据 enter image description here

试图更新类别字段ovementtype和intenstitype

0 个答案:

没有答案