A
AFSSkier
Is it possible to run a multi-pass query in access? The SQL has 3 select
queries with 2 temp_holds, then drops them.
Sample SQL
select a12.department_id,
sum(a11.sales_d_r52w) AS sales_d into temp_hold1
from division_r52w a11,
p_item a12
where a11.item_id = a12.item_id
and a11.week_id in (200848)
group by a12.department_id
GO
select a13.department_id,
sum(a11.sales_d_r52w) AS sales_d_yago into temp_hold2
from division_r52w a11,
t_week a12,
p_item a13
where a11.week_id = a12.prev_r52_wk_id and
a11.item_id = a13.item_id
and a12.week_id in (200848)
group by a13.department_id
GO
select pa11.department_id,
a13.department_desc,
pa11.sales_d,
pa12.sales_d_yago
from temp_hold1 pa11, outer
temp_hold2 pa12,
p_department a13
where pa11.department_id = pa12.department_id and
pa11.department_id = a13.department_id
GO
drop table temp_hold1
GO
drop table temp_hold2;
queries with 2 temp_holds, then drops them.
Sample SQL
select a12.department_id,
sum(a11.sales_d_r52w) AS sales_d into temp_hold1
from division_r52w a11,
p_item a12
where a11.item_id = a12.item_id
and a11.week_id in (200848)
group by a12.department_id
GO
select a13.department_id,
sum(a11.sales_d_r52w) AS sales_d_yago into temp_hold2
from division_r52w a11,
t_week a12,
p_item a13
where a11.week_id = a12.prev_r52_wk_id and
a11.item_id = a13.item_id
and a12.week_id in (200848)
group by a13.department_id
GO
select pa11.department_id,
a13.department_desc,
pa11.sales_d,
pa12.sales_d_yago
from temp_hold1 pa11, outer
temp_hold2 pa12,
p_department a13
where pa11.department_id = pa12.department_id and
pa11.department_id = a13.department_id
GO
drop table temp_hold1
GO
drop table temp_hold2;