Link to home
Start Free TrialLog in
Avatar of andyw27
andyw27

asked on

Datatable grouping

Hi,

I have data table and example of the data could be this

Key    Data
1        5
2        2
1        1
3        4

I need some way of grouping and summing the data so that what I end with is this:

Key    Data
1        6
2        2
3        4

Basically I need the key column to unique and the data column to be the sum of all the common key values

Is this even possible?
Avatar of Ali HND
Ali HND
Flag of Iran, Islamic Republic of image

SELECT key,  SUM (data)  FROM YourTableName  GROUP BY key;

Open in new window

Avatar of andyw27
andyw27

ASKER

Sorry, its a data table, not a SQL table
ASKER CERTIFIED SOLUTION
Avatar of Ali HND
Ali HND
Flag of Iran, Islamic Republic of image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I reckon you need to go thru the table and sum up the values yourself.
Avatar of andyw27

ASKER

Many Thanks, a particularly useful answer.