Показать сообщение отдельно
Старый 07.11.2006, 09:17   #3  
Protey is offline
Protey
Участник
 
143 / 15 (1) ++
Регистрация: 22.09.2005
Адрес: Сургут
в обычно SQL запросе остатки выглядят так:

Declare @Location As VarChar(20)
set @location = 'Склад'

select itemid, sum(postedQty + received - deducted + registered - picked) as QtySum
from bmssa.inventsum
where inventdimid in (select inventdimid from bmssa.inventdim where inventlocationid = @location and dataareaid = 'rus')
and dataareaid = 'rus'
group by itemid

делаем connection и все