Огого! Пока я тут торможу, кое-кто работает!
Обязательно до п.7 запускать пп. 1 - 6? А то запустил сразу 7 :
делаем 7
Не смогли выполнить запрос для рег = select * from (
select iddoc,sum(actno)as val0 ,max(actno) as val1, (max(actno)*(max(actno) + 1))/2 as val2 ,((max(actno)*(max(actno) + 1))/2-sum(actno)) as val3 from (
select iddoc , actno from ra3887
union all
select iddoc , actno from ra3906
union all
select iddoc , actno from ra17104
union all
select iddoc , actno from ra3824
union all
select iddoc , actno from ra4001
union all
select iddoc , actno from ra4198
union all
select iddoc , actno from ra16558
union all
select iddoc , actno from ra4202
union all
select iddoc , actno from ra17080
union all
select iddoc , actno from ra15078
union all
select iddoc , actno from ra15141
union all
select iddoc , actno from ra16658
union all
select iddoc , actno from ra16665
union all
select iddoc , actno from ra17196
union all
select iddoc , actno from ra21375
union all
select iddoc , actno from ra32778
union all
select iddoc , actno from ra32794
union all
select iddoc , actno from ra32806
union all
select iddoc , actno from ra32812
union all
select iddoc , actno from ra32817
union all
select iddoc , actno from ra37038
union all
select iddoc , actno from ra38919
union all
select iddoc , actno from ra38973
union all
select iddoc , actno from ra39168
union all
select iddoc , actno from ra39181
union all
select iddoc , actno from ra39498
union all
select iddoc , actno from ra39822
union all
select iddoc , actno from ra40276
union all
select iddoc , actno from ra40323
) as x1 group by iddoc
) as x2
inner join _1sjourn on _1sjourn.iddoc = x2.iddoc
and x2.val3 <> 0