BaseNow

 

  Search
   

  Help

Screen shots

Compare editions

Online help

Quick-start videos

System requirements

License agreement

Known issues

  Support

 Forums

Technical support

Feedback

 About the author

 Company

Contact

Privacy policy

  Features

BaseNow architecture

Database tools

BaseNow Agent

Tables and views

SQL Query Builder

Import/export data

  Subscribe

Stay informed about any major changes. Click here to subscribe

 

Group Rows in query results

If you want to create subtotals or show summary information for a table, you create groups using an aggregate query. Each group summarizes the data for all the rows in the table that have the same value.

Each group summarizes the data for all the rows in the table that have the same value.

For example, to generate a list of products with sales totals, you would use the Group By aggregate function like in the SQL statement below:

We only use two columns in this query; Price and ProductID. This is how this SQL query is transformed in the Grid pane:

The ProductID column uses Group By and the Price column SUM aggregate function.

If you run this query, your data would be organized like on the picture below:

In the example above, ProductID is the grouped column. The second column is produced by using the AVG( ) function with the price column.

You cannot display values from individual rows. For example, if you group only by publisher, you cannot also display individual titles in the query. Therefore, if you add columns to the query output, the program automatically adds them to the GROUP BY clause of the statement in the SQL pane. If you want a column to be aggregated instead, you can specify an aggregate function for that column. If you group by more than one column, each group in the query shows the aggregate values for all grouping columns.


Related Topics:

How to create a view

About SQL Query Builder

SQL Query Builder Layout

Add or remove a table

Add a column

Customize the table and view names

Customize the column names

Using criteria to retrieve certain records

Expression Builder

Using wildcard characters

Comparison operators

Logical operators

Mathematical operators

Show or hide a column in a view's results

Results Pane

[Home] [Download] [Screen Shots] [Details] [Support] [Purchase]

Copyright © 1997-2005 Gate Comm Software. All Rights Reserved.