Multi-Pass Query

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;
 
D

Duane Hookom

You can't do this in an Access query. You can create a small chunk of code
that runs one query after another.
 
A

AFSSkier

Thank you. I didn't think I could. Even using a union, it would take 2 or 3
separate queries.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top