Hi, I am trying a set the value of a field depending upon the below condition.

==========
UPDATE MEASUREMENT SET STATUS = ( IIF(
((SELECT SUM(QNTY) FROM Measurement_Individual_Delivery WHERE Measurement_Key_FK=[@KEYS] ) < (SELECT QUANTITY FROM MEASUREMENT WHERE KEYS=[@KEYS])),
'Pending','Delivered'))
WHERE KEYS=[@KEYS];
========


There is no syntex error but after giving the value of [@KEYS] I am getting an error "operation must use an updatetable query."
Can anyone help???