Online Documentation for SQL Query for PostgreSQL
Setting output fields
The Selection tab displays the output fields of the query as a grid.
Select only unique records
If you check this option, the duplicate records (if any) are not included into the query result (i.e. the DISTINCT keyword is added to the SQL query text).
To reorder fields in the list, use the buttons.
The grid allows you to edit the names of the query output fields, specify their displaying order and set the aggregate functions (SUM, MIN, MAX, AVG, and COUNT) for each field. To remove a field from the list, right-click the field row and select the Delete selected rows popup menu item.
To change the input query field, double click it and then type the field name on the keyboard or choose it from the drop-down list.
To change the output query field name, set the cursor at the corresponding column and type the required field name.
To set an aggregate function for a field, click the field row within the Aggregate column, and then type in the function name or select one from the drop-down list. The list contains user-defined aggregates too.
The Grouping column displays the grouping state for each of the output fields.
The popup menu also allows you to insert a nested query and add a CASE clause. To edit the CASE clause, use the CASE END AS dialog.
Use the drop-down list to define field to which the condition will be applied..
Name of the column that stores result values.
Use WHEN and THEN fields to define actual column values and their substitutions respectively. Empty WHEN clause states for all non-specified actual values. Such values will be substituted by the corresponding value specified in the THEN list.