Advertisement

06.23.2008 at 06:08PM PDT, ID: 23509622
[x]
Attachment Details

How do I get the sum of each numeric fields from multiple DataTables with similar keys and return one row (not looking for Merge)?

Asked by fferrer65 in ADO.Net Class Library, Databases Miscellaneous, C# Programming Language

Tags: C#, windows

Hi,

I have 3 DataTables (dtFdnCum, dtFdnNov, dtDMPFdn0211) with same schema.  I have 3 fields as part of the key and each DataTable can have the same key.  I want to combine the contents of the 3 DataTables, in the event there are same keys, all the numeric fields should be summed up and generate a single row.  Am not looking for a Merge as it doesn't perform a summation of similar keys.

Am trying to get a result similar to what the SQL below will generate:
SELECT cat_desc, camp_code, src_code,sum(day_cnt),sum(day_amt),sum(day_avg),sum(mon_cnt),sum(mon_amt),sum(mon_avg),sum(year_cnt),sum(year_amt),sum(year_avg),sum(cumul_cnt),sum(cumul_amt),sum(cumul_avg) FROM dtFdnCum, dtFdnNov, dtDMPFdn0211 group by cat_desc, camp_code, src_code;

Language is C#.  Thanks.Start Free Trial
 
Loading Advertisement...
 
[+][-]06.23.2008 at 10:24PM PDT, ID: 21852679

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 01:19PM PDT, ID: 21859996

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.25.2008 at 12:01PM PDT, ID: 21868808

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: ADO.Net Class Library, Databases Miscellaneous, C# Programming Language
Tags: C#, windows
Sign Up Now!
Solution Provided By: vbturbo
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.17.2008 at 05:56PM PDT, ID: 22031746

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 03:42PM PDT, ID: 22064365

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628