Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Browse?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00015660
Message ID:
00015694
Views:
43
>Well here is what I want to do. Run a query against 2 tables that are 1 to
> many. I can do that just fine.But when I browse it I want to see only 1
>instance of the parent with all of the associated child records. Right now I
>am getting duplicate parent records with each child record. I now this is
>not very clear but it is hard to explain. Thanks for all the help.

You're right, it is hard to explain. :-) I know exactly what you're doing, and what you want to see, but I can't explain it more clearly than you did....

Ok. As it stands, you're doing a SELECT command (or an RQBE -- same difference), and telling it to show fields from both tables. Since there's a one-to-many relationship, Fox has to fill in records from the one side many times, and those are your "duplicate" records.

To get the display result you want in a browse, what you need to do is:

SELECT child
SET ORDER TO childOrder
SELECT parent
SET RELATION TO childOrder INTO child
SET SKIP TO CHILD
BROWSE

This will result in something like this (if I can get it to format right):
p1f1  |  p1f2  |  child1
****  |  ****  |  child2
p2f1  |  p2f2  |  child3
****  |  ****  | child4
****  |  ****  | child5
How to get the correct records to show up on the one and many sides is left as an exercise for the reader. (Translation: I don't know what you're trying to do here. :-) )
My blog
My consulting page
My home page

Member of the Trim Your Auto-Quote Campaign!
What's another word for thesaurus?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform