I have a stored procedure that is used in a Crystal Report. When I run the query I get "'Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression." The code is:
UPDATE #tbl_company
SET desig_creamt = (SELECT sum(CH.creamt)
FROM #tbl_company TC INNER JOIN
frcrehis CH ON (TC.frid = CH.cmpid AND TC.capcod = CH.capcod) INNER JOIN
frdonmst DM1 ON CH.frid = DM1.frid
WHERE DM1.doncls IN ('I', 'ST')
GROUP BY CH.cmpid)
Please help I have spinning my wheels for two days on this. Thanks
UPDATE #tbl_company
SET desig_creamt = (SELECT sum(CH.creamt)
FROM #tbl_company TC INNER JOIN
frcrehis CH ON (TC.frid = CH.cmpid AND TC.capcod = CH.capcod) INNER JOIN
frdonmst DM1 ON CH.frid = DM1.frid
WHERE DM1.doncls IN ('I', 'ST')
GROUP BY CH.cmpid)
Please help I have spinning my wheels for two days on this. Thanks