2015-10-13 71 views
0

我想知道當我做一個更新與重複的行發生什麼,例如:SQL Server的更新查詢表中重複記錄

Table 1: 

Email    StatusID Status 
[email protected]  NULL  
[email protected]   1   Busy 
[email protected]  2   Online 
[email protected]   NULL  

Table 2: 

Email   Name    RejectionStatusID RejectionStatus 
[email protected] Dome      1    
[email protected] Phil      2 

結果?

Update Table2 
SET RejectionStatusID = StatusID, 
RejectionStatus = Status 
FROM Table2 Inner Join Table1 
ON Table2.Email = Table1.Email 

我想知道哪些重複,爲什麼?不太確定!當然,我做了查詢,並知道發生了什麼,但爲什麼?只想要一個解釋... 謝謝。

編輯: 這是例子,這是什麼發生在空值!!!

http://sqlfiddle.com/#!6/6ee69/1/0

回答