Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Counting Child Records
Message
 
 
To
07/05/2002 22:34:23
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00653805
Message ID:
00653942
Views:
15
>>I have two tables related together and want to be able to count the number of associated child records whenever I move the pointer in the parent table.
>>
>>How do I do this?
>
>Bruce, depending on how you're moving your pointer you could use the following. I'm guessing that you're moving the pointer in a grid and have the count showing in a text box or label.
>SELECT Count(*) FROM Child ;
>    WHERE Child.ForeignKey = Parent.PrimaryKey ;
>    INTO ARRAY laCount
>You can use the laCount[1] like a variable by just using laCount.

This would work as long, as you don't change parent/child tables (unbuffered).
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform