2016-09-27 69 views
0

是的我已閱讀當前發佈的文章,不,我無法弄清楚這一點。Multi joins Acess

我有多個連接發生,並且我不完全確定()去哪裏或SET應該去理想。

這裏是我的嘗試:

UPDATE authormash 
INNER JOIN article ON authormash.articletitle = article.articletitle SET authormash.articleid = article.articleid 
INNER JOIN article ON authormash.volume = article.volume 
INNER JOIN article ON authormash.issue = article.issue 
+1

呵呵?你爲什麼要三次加入同一張桌子? –

+0

也許我誤解了JOIN的用途,因爲第一個連接子句中有重複,我添加了其他人以確保連接是唯一的......? –

+1

爲什麼不查找[更新語法](http://www.w3schools.com/sql/sql_update.asp)而不是猜測或發佈問題?它不是很複雜。 – Igor

回答

0

一個JOIN的全部目的是基於它們之間有什麼共同的兩個表的信息結合起來。

這是你的原代碼:

UPDATE authormash 
INNER JOIN article ON authormash.articletitle = article.articletitle 
SET authormash.articleid = article.articleid 
INNER JOIN article ON authormash.volume = article.volume 
INNER JOIN article ON authormash.issue = article.issue 

看來,要更新authormash一些數據article和它們之間的共同點是articleid

下面是它看起來要做到:

update am 
set am.volume= a.volume 
--additional sets can go here 
from authormash am 
    inner join articles a on 
     am.articletitle = a.articletitle 

您可以隨時添加更多的SET語句這樣

, am.issue = a.issue 

可以包括WHERE條款,如果您需要過濾數據。

如果您可以更新的問題與更多的細節,我總是可以相應地更新答案。希望這可以幫助你。歡迎使用SQL。

+0

這有幫助嗎? – logixologist