Faq/Base/028

How to create calculated fields or results depending on a function applied to other fields?

Example: field C = addition (concatenation) of fields A & B

This effect cannot be produced directly in a table, one of the principles in a relational database is that calculated data is not stored, since it can be calculated.

With LibreOffice it is necessary to make use of a view or a query to produce the calculation.

For example, the following SQL command can be included in a request to concatenate the fields "field1" and "field2"

CONCAT( CONCAT( 'field1', ','), 'field2')

The result (if neither of the fields are null) will be ,  (for example Smith, Fred).

Note: The column header will, by default, be the formula used for the calculation. It is often preferable to add an alias to calculated fields.