Click here to Skip to main content
15,895,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 3 tables; item_master, order & helper. my item structure is like:
General (level1)
|____Content (level2)
| |___GnMain (level3)
| | |__vb6
| | |__vb.net
| | |__c#
| | |__f#
| |______jq
| |______js
|____________java

my question is how can i get the individual sum of each level and insert it into the helper table if customer order for maybe 6 of the product. at different quantities each in one order.

one way is to update the helper table while inserting each item but this will cause performers problem if the levels increase and also if more items are in the customer's order.
that is

foreach item
call udf to get parent, grandparent, greatgrandparent etc as the case may apply
then
foreach parents update oldsum+newsum

please i need a way out or point me to an article that can solve this business need perfectly.

thanks every one in advance.
Posted
Comments
AmitGajjar 23-Apr-13 6:56am    
if your hierarchy for the items are fix then you can use item_master to store quantities. at the time of update in the order you need to update your item_master. i think that would be easier for you.

1 solution

You can use GROUPING SETS, Refer Blog Post[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900