Unanswered: Update SQL Query with Multi-Part Where Clause
I am semi new to SQL server administration. I am trying to run an update on one of my databases. Here is the Query I am trying to run.
Update PartsLabor Set
PartsLabor.Units = (Select Units from Table_1)
Where Partnum =(Select PartNum from Table_1 where PartsLabor.PartNum = Table_1.PartNum)
and LaborType =(Select LaborType from Table_1 where PartsLabor.LaborType = Table_1.LaborType)
I am getting the following error when I run this query
Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.
I can't use "in" instead of "=" because there are a lot of records that may have either the PartNum or the LaborType but I need it to match on both records to update the specific row.