2016-11-09 56 views
1

在R工作組,並試圖通過運行左邊一列添加到現有的MonetDBLite表連接使用下列代碼的第二表:MonetDBLite左聯接語法

dbSendQuery(mdb, "UPDATE table1 
    SET table1.variable = table2.variable 
    FROM table1 LEFT JOIN table2 ON table1.identifier = table2.identifier;") 

返回錯誤:

Server says 'syntax error, unexpected '.', expecting '=' in: "update table1 
    set table1." 

是否MonetDB不支持點分隔符引用表中的字段?非常感謝任何見解。

+0

你的意思是左加入? – jarlh

+0

將'set table1.variable'更改爲'set variable'。 –

+0

感謝您的快速響應。但沒有運氣。拋出錯誤:「服務器說'語法錯誤,意外的FROM,期待SCOLON在:」更新表1 設置變量= table2.variable f「 – charlie

回答

1

想出了一種解決方法,即創建第三個表,而不是更新現有表,然後刪除原始表。 (很確定有一個更優雅的方式來做到這一點,但...)

dbSendQuery(db, "create table table3 as 
select a.*, 
b.variable 
from table1 as a 
left join table2 as b 
on 
(a.identifier = b.identifier);") 

dbRemoveTable(db, "table2")