What is the best way to get totals for Field1,2?
Select Field1,Field2,Field3,sum(field2) as sum_field1,sum(field2) as sum_field2
from table1
where field1='test'
sorry my first post was incorrect.
What is the best way to get totals for Field2 and field3?
Select Field1,Field2,Field3,sum(field2) as sum_field1,sum(field2) as sum_field2
from table1
where field1='test'
We'll say it again - you need a group by clause, and not only that, ALL the fields have to be grouped.
Select Field1,Field2,Field3,sum(field1) as sum_field1,sum(field2) as sum_field2,sum(field3) as sum_field3 from table1 where field1='test' group by Field1,Field2,Field3
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.