Rayne
asked on
TSQL Question here
Hello Gurus,
Please see attached
There are two tables –
Metric_DTrange that specifies for a given combination of product and saleClass – the a code (AGMT) and gives its metric VolW. Then there is a blank column “metric_sum” within it as well
Daily_m – is a table that lists a given combination of product + salesClass + daily date ad lists out the metric for that date.
What is needed – I need tp update column “Metric_sum” of table metric_DTRange is such a way - when I read for a given combination of product and salesClass in that table – I see the start and end dates. Then I go to the daily_m table to grab the [Metric] that lies within that date range for the same combination of product + salesClass.
For example:
AGMT Product salesClass st_date end_date VolW Metric_sum
TRN01 P1 A 3/1/2014 3/10/2014 14-Feb 46
Where the metric sum comes to 46 – it sums all te metric between the dates of 3/1 and 3/10 within the daily_m table and puts it in the metric_DTrange
Book3.xlsx
Please see attached
There are two tables –
Metric_DTrange that specifies for a given combination of product and saleClass – the a code (AGMT) and gives its metric VolW. Then there is a blank column “metric_sum” within it as well
Daily_m – is a table that lists a given combination of product + salesClass + daily date ad lists out the metric for that date.
What is needed – I need tp update column “Metric_sum” of table metric_DTRange is such a way - when I read for a given combination of product and salesClass in that table – I see the start and end dates. Then I go to the daily_m table to grab the [Metric] that lies within that date range for the same combination of product + salesClass.
For example:
AGMT Product salesClass st_date end_date VolW Metric_sum
TRN01 P1 A 3/1/2014 3/10/2014 14-Feb 46
Where the metric sum comes to 46 – it sums all te metric between the dates of 3/1 and 3/10 within the daily_m table and puts it in the metric_DTrange
Book3.xlsx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you