• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

Amalgamating Different 'Many' Tables

I have a stores table that has 'many' relationship with projects table. Recently, I had to introduce an entirely diiferent projects category, so I created a another projects table with 1-M relationship with the stores table. So now I have got two projects table with one parent.  The system works for me as data entry can be carried out seperately, however, there is a need for the business to report on projects in both tables using a single report.  I tried to create a query but the record set is not representative of both project tables.  Is there any other approach I may take to resolve this?  
0
khwajaa
Asked:
khwajaa
2 Solutions
 
Patrick MatthewsCommented:
Hello khwajaa,

Without knowing what your queries are all about, or what your table structures are, it is
hard to be too specific, but perhaps a UNION query will do it:

SELECT ...
FROM ...
UNION ALL
SELECT ...
FROM ...

Regards,

Patrick
0
 
khwajaaAuthor Commented:
Thanks. Queries are pretty standard showing a few fields from the parent and the rest from 'many' side. Union queries are limited in the sense that you have to have same fields. Some of my fields are different. Don't know how to manage these.

Cheers
0
 
mpmccarthyCommented:
You can set dummy values for those tables which are not common.

e.g. Customers [custID, custName] and Customers2 [custID, custAddress]

A union query to join these would be

SELECT custID, custName, "" As custAddress
FROM Customers
UNION ALL
SELECT custID, "" As custName, custAddress
FROM Customers2

0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now