Re: Combining Recordsets
- From: Klatuu <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 16 Apr 2008 13:31:00 -0700
The first problem I have is you M2M relationships. There really is no such
thing in a relational database. A logical M2M can exist, but to physically
resolve it, you use an intermediate table that sits between the two and is
1toM on both sides. For example, students and classes. One student can
enroll in 0 to many classes. A class may have 0 to many students enrolled.
Therefore, a M2M exsits between students and classes. That is resolved with
another table that needs only two fields, one for the Primary Key of the
student table and one for the Primary key of the class table. So each time a
student is enrolled in a class, a record is created to show the relationship.
Now from the student side, you can see which classes a student is enrolled
in and from the class side, you can see which students a are enrolled it a
class.
What I am getting at is that I suspect your relational design needs some
review.
But, based on your info, I think a Union query combining all 3 tables would
be the way to go. If you open Help in the VBA Editor and in the Table Of
contents, click on Microsoft Jet SQL Reference, Data Manipulation Language,
UNION Operation, perhaps that will give you some ideas.
--
Dave Hargis, Microsoft Access MVP
"David Wetmore" wrote:
On Wed, 16 Apr 2008 12:54:04 -0700, Klatuu <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:.
If all 3 have the same structure and data types, you could use a Union query
to combine them into one, possibly.
You question is a "how do I" question. It would be better if you describe
what you want to do and perhaps we can assist with how to accomplish it.
A good point.
I have 3 M2M relationships with the same master table. I wish to return records from
the master table which fit a minimal search on 0, 1, or 2 entries from the three M2M relationships.
The three link tables all contain a PKey and CKey field. Using these link tables I have
created three recordsets, one from each link table. Each recordset contains the PKey values selected
from that link table.
I want to combine the parent keys (PKey fields) from the 3 recordsets, eliminate duplicates and use the result in a
query on the master table.
- References:
- Combining Recordsets
- From: David Wetmore
- RE: Combining Recordsets
- From: Klatuu
- Re: Combining Recordsets
- From: David Wetmore
- Combining Recordsets
- Prev by Date: Filtering by older date first and by Range.
- Next by Date: Re: Form with multiple variables
- Previous by thread: Re: Combining Recordsets
- Next by thread: Re: Combining Recordsets
- Index(es):
Relevant Pages
|