Updating Two Tables

Question:
I have two tables:

  • Yarn {Y_yarn_code,x_code}y_yarn_code being PK
  • Yarn_lot (yl_yarn_code)

I need to update yl_yarn_code with x_code where y_yarn-code=yl_yarn_code

Answer:
Try this:

 UPDATE Yarn_Lot SET Yarn_Lot.yl_yarn_code = (SELECT x_code    FROM Yarn   WHERE Yarn.y_yarn_code =    Yarn_Lot.yl_yarn_code)

Is this what you intended?

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: