When performing SQL Query, you can have simple statistics calculated. These include average (arithmetic or weighted) and sum. Moreover, you can order result of the query based on one or more attributes and have statistics calculated for groups of entries.


    1. Arithmetic vs. weighted average.

Database Query Tool calculates average based on equation 

For arithmetic mean w=1 for every record. On the other hand, for weighted average, any numeric continuous variable is used as w.


    1. Changing the order of variables used for grouping

To change the order of variables used for grouping, simple use arrows to move them up or down in Selection tab.


The first ordering is based on Species, the second is based on DeadTree


The first ordering is based on DeadTree, the second is based on Species


    1. Grouping

Only discrete variables (i.e., attributes of ID or lookup list type) can be used as grouping variables. When grouping is active (at least one of attributes is set to be grouping attribute), all attributes represented by continuous variables must be set to produce average or/and sum. The result of the query does not provide individual data, but summaries per groups.


Example of simple grouping (average values are calculated for each species)


Example of combined grouping (average values are produced for groups defined based on species and vitality)