Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
476 views
in Technique[技术] by (71.8m points)

google bigquery - MERGE statement with OR in when_clause throws "RIGHT OUTER JOIN cannot be used without...."

I have some tables with two columns column1 and column2 (both string). I need to use some merge statement there, when I use simple example with ON like this

MERGE
  `tableFoo` foo
USING
  `tableBar` bar
ON
  foo.column1 = bar.column1 
  WHEN NOT MATCHED THEN INSERT (column1) VALUES (bar.column1)

it works as expected. But when I try to add OR to my when_caluse e.g.

ON 
  foo.column1 = bar.column1 OR foo.column2 = bar.column1

it will throw RIGHT OUTER JOIN cannot be used without a condition that is an equality of fields from both sides of the join.

Is it possible to use OR inside when_clause ? Same error if I use e.g foo.column1 != bar.column1

question from:https://stackoverflow.com/questions/66061679/merge-statement-with-or-in-when-clause-throws-right-outer-join-cannot-be-used-w

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...