Im very new on Sql server.
Here are two examples that seem to both work but Im not to sure.
Could someone evaluate these statements for me.
I would be very appreciative for the help.
Example1. this seems to update correctly
Example2 This also seems to update correctly.
The red is where I really got lost as TBL-2 doesn't have a
txtACT field but TBL-3 has A txtID field.
Here are two examples that seem to both work but Im not to sure.
Could someone evaluate these statements for me.
I would be very appreciative for the help.
Example1. this seems to update correctly
Code:
Update TBL-1
Set TBL-1.txtName = TBL-2.txtName
From TBL-2 INNER JOIN
TBL-3 ON TBL-2.txtID=TBL-3.txtID
Where TBL-1.txtACT = TBL-3.txtACT
AND TBL-3.txtR= ‘P’
Example2 This also seems to update correctly.
The red is where I really got lost as TBL-2 doesn't have a
txtACT field but TBL-3 has A txtID field.
Code:
UPDATE TBL-1
SET TBL-1.txtN = TBL-2.txtN
FROM TBL-2 INNER JOIN
TBL-1 INNER JOIN
TBL-3 ON TBL-1.txtACT = TBL-3.txtACT
[COLOR=red] AND
TBL-1.txtACT = TBL-3.txtACT ON TBL-2.txtID = TBL-3.txtID[/color]
WHERE tblRelationships.txtRelationship = 'P'