Reputation: 43
Not sure why its throwing an error at t2. I am trying to run a simple sql query. Running on MS-SQL and the error message says 'incorrect syntax near t2'
UPDATE t1
SET t1.EmpSubCompetency = t2.EmpSubCompetency,
t1.Competency = t2.Competency,
t1.FileName = t2.FileName,
t1.Longitude = t2.Longitude,
t1.Latitude = t2.Latitude,
t1.SubAreaName = t2.Region,
t1.SectorTag=t2.SectorTagClassification
FROM dbo.STG_MyCompetencies t1
LEFT JOIN (select * from dbo.STG_EmployeeMaster where Act_Flg='Y') t2
Upvotes: 0
Views: 57
Reputation: 1269743
Your problem is the missing ON
clause. Further, you don't need a subquery for this logic:
FROM dbo.STG_MyCompetencies t1 LEFT JOIN
dbo.STG_EmployeeMaster t2
ON t1.??? = t2.??? AND
em.Act_Flg = 'Y'
Note that unmatched rows will have all the columns set to NULL
.
The ???
is for whatever column should be used for the JOIN
.
Upvotes: 1