最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Merge to Update in Spark SQL - Stack Overflow

programmeradmin1浏览0评论

My code in TSQL is like this:

UPDATE A
SET A.SHARE = some_new_value
FROM DB.TABLE_A A
INNER JOIN DB.TABLE_B B ON A.col = B.col,
( SELECT C.col FROM DB.TABLE_C C) fcal
WHERE B.col = fcal.col and A.col = fcal.col AND A.col>0 and fcal.col>0 

When I have to update table A using a single table in SPARK SQL, I can easily do that using:

MERGE INTO DB.TABLE_A A
USING DB.TABLE_B ON......
WHEN MATCHED THEN SET UPDATE A.col = some_new_value

But how do you do the same operation with multiple tables or subqueries like in my case? In the above examples, 'col' is just a placeholder for the actual column.

发布评论

评论列表(0)

  1. 暂无评论