DmitrO писал(а) 26. Марта 2007 :: 12:13:Программа так и говорит: "Не получаеться определить остатки..."?
PS:Наверно модификатор у параметра надо поставить.
Нет она говорит:
Система говорит не могу найти альянс...
SELECT Спр.id as id
FROM sc84 as Спр (nolock)
where (ISNULL((SELECT SUM(Рег1.КоличествоОстаток)
FROM (
select
rr405_vt.sp4062 as Фирма,
rr405_vt.sp408 as Номенклатура,
rr405_vt.sp418 as Склад,
sum(rr405_vt.sp411) as КоличествоОстаток
from (
select
rg405_vt.sp4062,
rg405_vt.sp408,
rg405_vt.sp418,
rg405_vt.sp411
from rg405 as rg405_vt (nolock)
where rg405_vt.period={d '2006-10-01'}
and ((rg405_vt.sp418 =' 1 ') AND (rg405_vt.sp4062=' 1 ') AND (rg405_vt.sp408 = Спр.id))
union all
select
ra405_vt.sp4062,
ra405_vt.sp408,
ra405_vt.sp418,
case ra405_vt.debkred when 0 then ra405_vt.sp411 else -ra405_vt.sp411 end
from ra405 as ra405_vt (nolock)
inner join _1sjourn as j405_vt (nolock) on j405_vt.iddoc = ra405_vt.iddoc
where j405_vt.date_time_iddoc > '20061101' and j405_vt.date_time_iddoc < '20061102'
and j405_vt.rf405 = 0x1
and ((ra405_vt.sp418 =' 1 ') AND (ra405_vt.sp4062=' 1 ') AND (ra405_vt.sp408 = Спр.id))
) as rr405_vt
group by
rr405_vt.sp4062,
rr405_vt.sp408,
rr405_vt.sp418
having
sum(rr405_vt.sp411) <> 0
) as Рег1),0)-
ISNULL((SELECT SUM(Рег2.КоличествоОстаток )
FROM (
select
rr4480_vt.sp4475 as Фирма,
rr4480_vt.sp4477 as Номенклатура,
rr4480_vt.sp4476 as Склад,
sum(rr4480_vt.sp4479) as КоличествоОстаток
from (
select
rg4480_vt.sp4475,
rg4480_vt.sp4477,
rg4480_vt.sp4476,
rg4480_vt.sp4479
from rg4480 as rg4480_vt (nolock)
where rg4480_vt.period={d '2006-10-01'}
and ((rg4480_vt.sp4476 =' 1 ') AND (rg4480_vt.sp4475=' 1 ') AND (rg4480_vt.sp4477 = Спр.id))
union all
select
ra4480_vt.sp4475,
ra4480_vt.sp4477,
ra4480_vt.sp4476,
case ra4480_vt.debkred when 0 then ra4480_vt.sp4479 else -ra4480_vt.sp4479 end
from ra4480 as ra4480_vt (nolock)
inner join _1sjourn as j4480_vt (nolock) on j4480_vt.iddoc = ra4480_vt.iddoc
where j4480_vt.date_time_iddoc > '20061101' and j4480_vt.date_time_iddoc < '20061102'
and j4480_vt.rf4480 = 0x1
and ((ra4480_vt.sp4476 =' 1 ') AND (ra4480_vt.sp4475=' 1 ') AND (ra4480_vt.sp4477 = Спр.id))
) as rr4480_vt
group by
rr4480_vt.sp4475,
rr4480_vt.sp4477,
rr4480_vt.sp4476
having
sum(rr4480_vt.sp4479) <> 0
) as Рег2),0))<>0
ODBCRecordset error:
State 42000, native 107, message [Microsoft][ODBC SQL Server Driver][SQL Server]The column prefix 'Спр' does not match with a table name or alias name used in the query.
Активизировать("ТекстЗапроса");
В данной формуле не может быть вызвана эта процедура(функция)
Тот же запрос на начало месяца все окей....