Ok, so im pretty new to SQL and im trying to write a query to replace the number 2 with the number 4 if the officeid=10 so what I have at the moment is the following. One table is called Carer_Supervisions and this is linked to another table VIA a secondary key and the officeid is on another table called carer_information.
SELECT Carer_Supervisions.SupervisionID
,Carer_Supervisions.RegionID
,Carer_Supervisions.Date_Created
,Carer_Supervisions.Created_By
,Carer_Supervisions.Complete
,Carer_Supervisions.Completed_Date
,Carer_Supervisions.Completed_By
,Carer_Supervisions.CarerID
,Carer_Supervisions.Visit_Date
,Carer_Supervisions.SSW
,Carer_Supervisions.Location
,Carer_Supervisions.Present
,Carer_Supervisions.Child1
,Carer_Supervisions.Child2
,Carer_Supervisions.Child3
,Carer_Supervisions.Child4
,Carer_Supervisions.Child5
,Carer_Supervisions.Child6
,Carer_Supervisions.Child7
,Carer_Supervisions.Child8
,Carer_Supervisions.Caring_for_Children
,Carer_Supervisions.Education
,Carer_Supervisions.Working_Team
,Carer_Supervisions.Training_and_Development
,Carer_Supervisions.Environment
,Carer_Supervisions.Concerns
,Carer_Supervisions.Personal
,Carer_Supervisions.Agency
,Carer_Supervisions.Day_Care
,Carer_Supervisions.Manager
,Carer_Supervisions.Carer_Signed
,Carer_Supervisions.Cancelled
,Carer_Supervisions.Cancel_Reason
,Carer_Supervisions.Signed_Sent
,Carer_Information.OfficeID
FROM Carer_Supervisions
INNER JOIN Carer_Information ON Carer_Supervisions.CarerID = Carer_Information.CarerID
UPDATE Carer_supervisions
SET RegionID = REPLACE(RegionID, '2', '4')
WHERE (Carer_Information.OfficeID = 10)
is this right or need amending?