Tying records

J

Jeff

Hi

I am working on an existing database. I want to create a query which
pulls data from 2 child records of a parent. The first record in my
query would contain information frmo the first child record along with
the first child record of the other table, the second to the second,
etc.

Is there a way to do this? Could someone help?

Thanks

Jeff
 
R

Ron2006

I am not sure I understand exactly what you are trying to receive
back.

Here is a method that may get you what you want depending on how your
tables are related.

If the child records are in the same child Table
Maintable
ID
MainTableData


ChildTable
ID
MainID
ChildType
ChildData


Query would have

main table

and the child table TWICE in the query wizard
Link the ID from the main Table to the MainID in BOTH child tables

If the child table ALWAYS have both records then leave the links as
normal
If the child table MIGHT not have one or both of the child records,
then change the links to both tables to say give you all records of
main table and those only of child table that match.

Data for the query would be

from main table
ID
MainTableData
ChildType from ChildTable 1
condition would be the type for one of the two records.
ChildDATA from childTable1

ChildType from ChildTable2
Condtion would be the type for the other of the two records
ChildData from childTable2


===========
If the child tables are two different tables everything would be the
same but the second child would simply be the second child table.

Ron
 
J

John W. Vinson

Hi

I am working on an existing database. I want to create a query which
pulls data from 2 child records of a parent. The first record in my
query would contain information frmo the first child record along with
the first child record of the other table, the second to the second,
etc.

Two child *tables* I presume?

If you're assuming that records in a table have record numbers, or that there
is a "first" and "second" record in a table, you're on the wrong track: tables
are unordered "bags" of data, not ordered rows like a spreadsheet. Do you have
some field or fields in the child tables which determine the order? Can you
reliably count on the two child tables having the same number of records for
any given parent table record? If not, what do you want to see?

Perhaps an explanation of the real-world problem here would help!
 

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