SQL Update to table from data in a view not working
Posted on 2007-10-05
SQL Server 2000, SP4. Trying to get an update from one table to another to work. Here are the players"
EDPNO (numeric), Days (varchar)
Table 2: VENDORITEMS
Cols EDPNO (numeric), VENDORNO (character 8), LEADTIME (character 4)
also many fields that are not related to this problem.
Table 3: ITEMMAST
Cols EDPNO (numeric), VENDORNO (character 8)
Running this statement:
Update VENDORITEMS set LEADTIME =
Select A.EDPNO, B.VENDORNO,
substring('0000',1, 4- Len(cast(AVG(A.Days)as char(4)))) + cast(AVG(A.Days)as char(4)) AS lead
FROM LeadTimes A
INNER JOIN ITEMMAST B
ON A.EDPNO = B.EDPNO
Where A.EDPNO = B.EDPNO
GROUP BY A.EDPNO, B.VENDORNO
Returns this error: "Only one expression can be specified in the select list when the subquery is not introduced with EXISTS."
Any help would be greatly appreciated.
Running this statement