insert a column record within the same table between two "identical" records

I have a table named frmRegistrationCSW.

I copied a group of records in the table to make duplicate records.  When I did so I made a mistake and one of the columns did not get copied over.  The column is named 'Sector'  To fix the problem I setup the following code, but I know there are some issues.  I get the error:
Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "R14.Sector" could not be bound.

Help please!

      
UPDATE frmRegistrationCSW
SET R14.Sector = R13.Sector
WHERE ID IN (
SELECT R13.ID
   FROM frmRegistrationCSW AS R13
   INNER JOIN frmRegistrationCSW AS R14
      ON R13.frmRegistrationCSWText2 = R14.frmRegistrationCSWText2
      AND R13.frmRegistrationCSWText4 = R14.frmRegistrationCSWText4
      AND R13.frmRegistrationCSWText5 = R14.frmRegistrationCSWText5
      AND R13.fiscal = 2013
      AND R14.fiscal = 2014
      AND R13.Redetermination = 'Completed'
      AND R13.[CSW/TitleXX] = 'B')

Open in new window

al4629740Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle AbrahamsSenior .Net DeveloperCommented:
UPDATE R14
SET R14.Sector = R13.Sector
from frmRegistrationCSW R14
INNER JOIN frmRegistrationCSW AS R14
                   frmRegistrationCSW AS R13
      ON R13.frmRegistrationCSWText2 = R14.frmRegistrationCSWText2
      AND R13.frmRegistrationCSWText4 = R14.frmRegistrationCSWText4
      AND R13.frmRegistrationCSWText5 = R14.frmRegistrationCSWText5
      AND R13.fiscal = 2013
      AND R14.fiscal = 2014
      AND R13.Redetermination = 'Completed'
      AND R13.[CSW/TitleXX] = 'B'
      AND R13.ID = R14.ID
0
al4629740Author Commented:
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near 'frmRegistrationCSW'.
0
chaauCommented:
I do not want to steal point from ged. There is a small typo. He will fix it
0
Kyle AbrahamsSenior .Net DeveloperCommented:
UPDATE R14
SET R14.Sector = R13.Sector
from frmRegistrationCSW R14
INNER JOIN frmRegistrationCSW AS R13
      ON R13.frmRegistrationCSWText2 = R14.frmRegistrationCSWText2
      AND R13.frmRegistrationCSWText4 = R14.frmRegistrationCSWText4
      AND R13.frmRegistrationCSWText5 = R14.frmRegistrationCSWText5
      AND R13.fiscal = 2013
      AND R14.fiscal = 2014
      AND R13.Redetermination = 'Completed'
      AND R13.[CSW/TitleXX] = 'B'
      AND R13.ID = R14.ID

Sorry must have pasted twice.  Chaau always feel free to steal away :-).  If anything the poster could split the points based on the help each expert gave.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.