Larry,
Do you think this is a good idea, maintaining the child count in the parent table?
>Isaac,
>Are you talking about creating an SP for this? The parameter you passed in would be used to select the parent and the child.
>
>If you aren't then you need to create a cursor from the parent table select and fetch each pcode. Then use this to process all parent and child rows.
>
>HTH.
>
>>Hello,
>>
>>I'm trying to figure out the syntax for updating a count column based on the child table count.
>>Parent table has the columns columns pcode, childcount
>>Child table has the columns pcode, childname
>>
>>I'm thinking I want to do something like the following, though I'm stuck
>>figuring out how to finish the sql
>>
>>update parent
>>set childcount =
>> (select COUNT(item_code)
>> from child
>> where child.pcode = parent.pcode)
>>
>>How do I tell the subquery what the parent.pcode is?
>>
>>Any suggestions would be greatly appreciated.
>>
>>Thanks,
>>-Isaac
Chris McCandless
Red Sky Software