Lesson 31 ª






Calculating on Tables

We can also perform calculations on all the Records of a Table without having to group them under any concept or condition. This can be used to find out, for example, the total of "Clients", or the total of Products we have in the ware house, or the average price of our sales.

We will count the products we have in our ware house. First, we will create a Query from the "Products" table. We will only select the "In Stock" field, since we already know how to. REMEMBER: I have added values to our tables to make these examples. You can use the values you like.

If we execute (Run) the Query, this will be the result:

Now, on the design view of the Query, we will place the cursor on the "In Stock" field row and click on the right button of the mouse.

We will select "Totals" and we will see that a new row has been added to the grid. It is called "Total". By default, it will say "Group by". But if we open up the options (black arrow) we will find a long list of possible orders we can apply to the field.

In this case, we want to add "Sum" the total In Stock. However, we can also find out the minimum value (Min), the maximum value (Max), the average (Avg), and other functions.

After we Run the query, this will be the result: