Skip to content
Advertisement

Show results from different queries in 1 overview in MS-ACCESS

I have different relational tables and I perform different queries on these tables to get some results.

This is 1 example of a query called PBF

And this is another one called RT MD Bajar

In the end what I need is 1 query showing me the results from all these queries in 1 overview. But my problem is I can’t make a UNION work because I have different where clauses in the different queries and I cant make a left join work because I have different where clauses in the different queries.

This is how far I got but it doesn’t work because of the where clauses:

Advertisement

Answer

You turn both existing queries to subqueries, and then JOIN them.

Your query would essentially be:

You can change the INNER JOIN to a LEFT JOIN (and possibly change the order of the derived tables) as you need, but the logic stays the same.

Note: if you need results in rows and not in columns, you can also use UNION ALL with the same technique (turn the existing queries to subqueries).

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement