Summing multiple fields in a whole table

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
damon.cognito
Posts: 50
Joined: Wed 22 Jul 2009 09:30

Summing multiple fields in a whole table

Post by damon.cognito » Mon 07 Dec 2009 11:28

I've been looking to do a sum of fields in a table and cannot find a way to do it - hopefully I am missing something smiple! This is how I would do it using SQL:

Code: Select all

SELECT sum(field1), sum(field2), sum(field3) from atable
Any ideas anyone please?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 07 Dec 2009 12:02

You can write an Entity SQL query selecting the sum of the necessary fields like in the following example:

Code: Select all

select sum(a.field1), sum(a.field2), sum(a.field3) from atable as a;

Post Reply