views:

27

answers:

1

i have created multiple sequential sql query objects for an ms access database. e.g

objectA is named sqlqueryA

and contains the sql code

Select a, b, ........From TableA

objectB is named sqlqueryB

and contains the sql code

Select a, m, n...... From sqlqueryA

objectC is named sqlqueryC

and contains the sql code

Select x, y, z ..... from sqlqueryB

each query is saved as a different object in my ms-access database , how can i create one object containing all queries

+1  A: 

You can UNION:

Select a, b,"" as c ........From TableA
UNION ALL
Select a, m as b, n as c...... From sqlqueryA
UNION ALL
Select x As a, y as b, z as c ..... from sqlqueryB

Note that sqlqueryA and sqlqueryB could be included as subqueries.

You can JOIN, as long as you have a field with common data:

SELECT t.a, t.b,s.m, s.n...... 
FROM TableA t 
INNER JOIN sqlqueryA s
ON t.a=s.a

You might like to read:

Fundamental Microsoft Jet SQL for Access 2000
Intermediate Microsoft Jet SQL for Access 2000
Advanced Microsoft Jet SQL for Access 2000

Remou