Question : Need help with Update problem

The following query works correctly and correctly returns the two rows I expect.  It is a many to 1 relationship.

SELECT * FROM PHYSICALINV PI, ICFSS SS
     WHERE (SS.STORES_CODE = PI.Stores_Code) AND (SS.PART_ID = PI.Part_ID) AND (SS.PART_ID= '100-001135') AND (PI.QTY_VAR < 0)

Now I want to be able to update the ICFSS table where the results from the previous query are found.  I have the following update statement:

declare @TODAY CHAR(10)

SET @TODAY = (SELECT
                  CONVERT(VARCHAR(10), GETDATE(), 101) AS [MM/DD/YYYY])
 
UPDATE ICFSS
SET ISSUES_MTD = (ISSUES_MTD + PHYSICALINV.NEW_QTY), ISSUES_YTD = (ISSUES_YTD + PHYSICALINV.NEW_QTY),
ON_HAND_QTY = (ON_HAND_QTY + PHYSICALINV.QTY_VAR), DATE_LAST_ISSUE = @TODAY, DATE_LAST_ACT = @TODAY, OPERATOR_ID = 'SYS.CD',
TIME_LAST_UPDT = convert(char(5),getdate(),108), DATE_LAST_UPDT = convert(char(11),getdate(),101)
WHERE (SELECT * FROM PHYSICALINV PI, ICFSS SS
     WHERE (PI.Stores_Code = SS.STORES_CODE) AND (PI.Part_ID = SS.PART_ID) AND (SS.PART_ID= '100-001135') AND (PI.QTY_VAR < 0))

The correlated subquery is a copy of the one from above that works.  However, when I run my update, I get the following error:
Msg 4145, Level 15, State 1, Line 13
An expression of non-boolean type specified in a context where a condition is expected, near ')'.

I have tried joins and all other kinds of syntax and can't get by this one.   A little help would be great.

Answer : Need help with Update problem

Try this one.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
declare @TODAY CHAR(10)

SET @TODAY = (SELECT
                  CONVERT(VARCHAR(10), GETDATE(), 101) AS [MM/DD/YYYY])

UPDATE ICFSS
SET ISSUES_MTD = (ISSUES_MTD + PHYSICALINV.NEW_QTY), ISSUES_YTD = (ISSUES_YTD + PHYSICALINV.NEW_QTY),
ON_HAND_QTY = (ON_HAND_QTY + PHYSICALINV.QTY_VAR), DATE_LAST_ISSUE = @TODAY, DATE_LAST_ACT = @TODAY, OPERATOR_ID = 'SYS.CD',
TIME_LAST_UPDT = convert(char(5),getdate(),108), DATE_LAST_UPDT = convert(char(11),getdate(),101)

FROM PHYSICALINV PI, ICFSS SS
     WHERE (PI.Stores_Code = SS.STORES_CODE) AND (PI.Part_ID = SS.PART_ID) AND (SS.PART_ID= '100-001135') AND (PI.QTY_VAR < 0)
Random Solutions  
 
programming4us programming4us