There is a request:
select @a=sum(количество ) from Заявка where Статус='В пути' AND Заявка.Наименование_детали=@с group by Наименование_детали It returns null, can it be done so that it returns zero? Because of this, the update does not work
update Ведомость_материалов set Чистая_потребность=@b-Колличество_на_складе-@a where Ведомость_материалов.Материал=@q because null = null
...=coalesce(sum(количество), 0)...- Igor... ISNULL(SUM(количество), 0)... By the way, why do you have agroup byinitial request? - Yaant