Page tree
Skip to end of metadata
Go to start of metadata

 

Spreadsheets are expected to make calculations. In version 2.2, Play SQL introduces Totals. They allow you to perform any kind of calculation:

  • Simple calculations like "SUM(column_name)" are available,
  • Advanced calculations using SQL are possible too.

See this example:

 

 

 

For Queries

Step 1. Add a Totals row

There is no bottom row by default for queries. Click "Add Options", then "Totals":

A bottom line appears at the bottom of the table, in addition to the mention in the gray area. They are linked: If you remove one, the other will go away too.

Step 2. Double-click on the bottom line

Double-click the bottom line and add your formula:

For Spreadsheets

Step 1. Create a table

If you want to perform calculations on numbers, you need the column type to be a number (currency, decimal or integer):

Open the column's menu, click "Change Format":

Select Integer:

 

Step 2. Double-click on the bottom line

The first field (named "Place label here") allows you to put a static text ahead of the total.

The second field is the formula.

Step 3. Write a formula

Fortunately, a tooltip helps you for that. Refer to Formulas for the specifics. Remember:

  • You must use column keys, such as "number_of_boxes" above.
  • Column keys aren't labels. There's a tooltip over column labels to tell you about their keys, and you can change the key by going to the Column Properties dialog.
  • Operations such as SUM(number_of_boxes) are sufficient.

Step 4. Validate

Press Enter. The total will be replaced by its value:

Totals are always aligned on the right.

  • No labels