I am running this

Sum(Area(obj, "sq km")), area(obj,"sq km"), count(*)

from a table

Now both areas are not the same for the objects. What one is correct?

On a created layer with 1 object I made, the values are the same, on the OS MASTER map it gives two different results.


Sum and Count are aggregate functions meaning that you need to Group the data by a column for them to be meaningful. In MapInfo, area(obj,"sq km"), will simply return the area for the first object that it finds whereas Sum(Area(obj, "sq km")) will sum the areas for all objects that have the same attribute value in the "Grouped By" column.

| improve this answer | |
  • And if you don't add a Grouping expression, your result set will just contain one single row - aggregated for the entire table – Peter Horsbøll Møller Mar 31 '14 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.