Need help with the Merge statement

前端 未结 3 1568
轻奢々
轻奢々 2021-01-13 08:11

I want to update a table called Sorels_ext from a table called Sorels. The link between them is the fkey_id of Sorels_ext equals the identity_column of the Sorels table. Thi

3条回答
  •  不思量自难忘°
    2021-01-13 08:53

    I believe you have to alias your your source data like so:

    USING (select SOR.identity_column, 
       CASE  WHEN left(SOR.FPARTNO, 2) = 'BL' 
       THEN 'Blue'        
       WHEN left(SOR.FPARTNO, 2) = 'RD' 
       THEN 'Red'        
       ELSE 'White'      
       END from Sorels AS SOR) **AS SOR** ON  (SORe.fkey_id = SOR.identity_column)
    

提交回复
热议问题