Find Jobs
Hire Freelancers

Hierarchical Summary UPDATE Query for MSSQL

$10-30 USD

In Progress
Posted almost 9 years ago

$10-30 USD

Paid on delivery
/* CumulativeSum Column Calculation on Hierarchical Table Write Update query for "CumulativeSum" column You can see an example result in remark area. Simply you will cumulative summary over CumulativeSum column on hierarchical table. */ CREATE TABLE #Tree ( Id int, RootId int, FullName varchar(200), QTY int, CumulativeSum int ) INSERT #Tree Select 1, -1, 'ROOT 1', 0, 0 INSERT #Tree Select 2, 1, 'SUB ITEM 1.1', 9, 0 INSERT #Tree Select 3, 1, 'SUB ITEM 1.2', 3, 0 INSERT #Tree Select 4, 3, 'SUB ITEM 1.2.1', 1, 0 INSERT #Tree Select 5, 3, 'SUB ITEM 1.2.2', 7, 0 INSERT #Tree Select 6, 1, 'SUB ITEM 1.3', 5, 0 INSERT #Tree Select 7, 6, 'SUB ITEM 1.3.1', 2, 0 INSERT #Tree Select 8, 7, 'SUB ITEM 1.3.1.1', 18, 0 INSERT #Tree Select 9, -1, 'ROOT 2', 0, 0 INSERT #Tree Select 10, -1, 'ROOT 3', 0, 0 INSERT #Tree Select 11, 10, 'SUB ITEM 3.1', 1, 0 INSERT #Tree Select 12, 11, 'SUB ITEM 3.2', 10, 0 INSERT #Tree Select 13, 12, 'SUB ITEM 3.3', 4, 0 INSERT #Tree Select 14, 13, 'SUB ITEM 3.3.1', 2, 0 INSERT #Tree Select 15, 13, 'SUB ITEM 3.3.2', 5, 0 /* FOR EXAMPLE 1 -1 ROOT 1 0 45 2 1 SUB ITEM 1.1 9 9 3 1 SUB ITEM 1.2 3 11 4 3 SUB ITEM 1.2.1 1 1 5 3 SUB ITEM 1.2.2 7 7 6 1 SUB ITEM 1.3 5 25 7 6 SUB ITEM 1.3.1 2 20 8 7 SUB ITEM 1.3.1.1 18 18 */ Select * From #Tree DROP TABLE #Tree
Project ID: 8122171

About the project

2 proposals
Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
2 freelancers are bidding on average $23 USD for this job
User Avatar
i have more then 5 yrs of exp in sql scripting and very good experience in my sql , oracle and sql. I have done lot of task like that
$25 USD in 1 day
5.0 (30 reviews)
4.8
4.8
User Avatar
Hi, I've worked with hierarchical tables before and I can help you with this. you basically need a query that goes through all the hierarchical tree in the table and updated the CumulativeSum column accordingly. Let me know if you are interested :)
$20 USD in 1 day
5.0 (5 reviews)
1.6
1.6

About the client

Flag of TURKEY
Antalya, Turkey
5.0
9
Payment method verified
Member since Feb 28, 2012

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.