build up columns from multiple records

A

ArielYakML

I am working with a table that contains child records. in a new query i would
like to construct a parent record that contains different columns for fields
in the child records depending on the entry of the field. my problem is that
i get more than 1 record since there are multiple child records. how can i go
about populating a record from multiple records which are assosiated by an
ID.

Thanks,
Ariel
 
J

John W. Vinson

I am working with a table that contains child records. in a new query i would
like to construct a parent record that contains different columns for fields
in the child records depending on the entry of the field. my problem is that
i get more than 1 record since there are multiple child records. how can i go
about populating a record from multiple records which are assosiated by an
ID.

I'm not sure I follow. Could you give an example of the data in these two
tables and the desired outcome?

John W. Vinson [MVP]
 
A

ArielYakML

I have a table that contains the following fields:

UnitID
UnitType
ParentUnitID
Description (can have 5 different descriptions
[desc1][desc2][desc3][desc4][desc5] ) which are pulled from a lookup table

i am trying to create a query that will display a unitID and
[desc1][desc2][desc3][desc4][desc5], under desc1 i want the query to return
YES or NO if there is a record under this particular UnitID with the
description of desc1. same for each other descrtiption. what i end up getting
is multiple records for the same unitID.
i would like to get the data in one record that says "yes" or "NO" under
each description if that record exists as a child of the current unitID.
 
J

John W. Vinson

I have a table that contains the following fields:

UnitID
UnitType
ParentUnitID
Description (can have 5 different descriptions
[desc1][desc2][desc3][desc4][desc5] ) which are pulled from a lookup table

i am trying to create a query that will display a unitID and
[desc1][desc2][desc3][desc4][desc5], under desc1 i want the query to return
YES or NO if there is a record under this particular UnitID with the
description of desc1. same for each other descrtiption. what i end up getting
is multiple records for the same unitID.
i would like to get the data in one record that says "yes" or "NO" under
each description if that record exists as a child of the current unitID.

Your table structure IS WRONG.

If you can have five descriptions, someday you may really really need a sixth.

A Many to Many relationship between Units and Descriptions should use *a third
table*:

UnitDescriptions
UnitID <link to UnitID of the Units table>
DescID < link to primary key of your descriptions lookup table>


This gives you just one field to search for a particular description.

John W. Vinson [MVP]
 

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