SQL UPDATE statement with WHERE EXISTS

Im trying to write a query that updates a date only if the group im updating has a LINE_CD of 50. Would i do it like this?

UPDATE EMPLOYER_ADDL  
SET EMPLOYER_ADDL.GTL_UW_APPRV_DT = EMPLOYER_ADDL.DNTL_UW_APPRV_DT 
WHERE EXISTS
    ( 
      SELECT EMP_PLAN_LINE_INFO.LINE_CD
      FROM EMP_PLAN_LINE_INFO
      Where EMP_PLAN_LINE_INFO.GR_NBR = EMPLOYER_ADDL.GR_NBR and
       EMP_PLAN_LINE_INFO.LINE_CD = 50
     )


Read more here: https://stackoverflow.com/questions/9023879/sql-update-statement-with-where-exists

Content Attribution

This content was originally published by user1152145 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: