Hello,
Using SQL Server.
I am trying to update a table using 2 inner joins.
I am getting a syntax error with the following:
Update T1
set T1.JobCost = (Select Sum(T3.EmployeeCharges)
From SubJob T1 INNER JOIN Route T2
ON T1.JobSubNbr = T2.JobSubNbr
INNER JOIN EmployeeTime T3
ON T2.RouteNbr = T3.RouteNbr
All column names are correct.
There are 3 tables:
T1 = SubJob PK = JobSubNbr
T2 = Route PK = RouteNbr & FK = JobSubNbr
T3 = EmployeeTime FK = RouteNbr
I want to update the JobCost column in T1 with the Sum of EmployeeCharges in T3 which are assoicate to Routes with that SubJob
SubJobs have 1 to many Routes
Routes have 1 to many EmployeeTimes
Why am I getting a syntax error?
Bookmarks