Page 1 of 1

Summing multiple fields in a whole table

Posted: Mon 07 Dec 2009 11:28
by damon.cognito
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?

Posted: Mon 07 Dec 2009 12:02
by AndreyR
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;