2015-10-13 68 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

回答