Previous Topic: Combining ConditionsNext Topic: Special Statements


Aggregate Functions in Conditions

You can include aggregate functions and aliases defined by the keyword AS in conditions. The following examples illustrate the syntax of aggregate functions in conditions:

Conditions

Examples

Volumes With Total File Size Greater Than 1 GB

To select all the volumes where total file size is greater than 1 GB, enter the following:

VOLUME_NAME WHERE SUM(FILE_SIZE)> 1 GB

Volumes That Exceed 90 Percent of the Largest Volume

To select all the volumes the size of which exceeds 90 percent of the size of the largest volume, enter the following:

VOLUME_NAME WHERE VOLUME_SIZE > 0.9 * MAX(VOLUME_SIZE)

Files Greater Than Average

To select all the files with sizes greater than the average, enter the following:

FILE_FULL_NAME WHERE FILE_SIZE > AVERAGE(FILE_SIZE)

Query Table Listing Owner Names and Files for Owners With More Than 100 MB Data

To define a query result table listing owner names and files for each owner that has more than 100 MB of data, enter the following:

OWNER_NAME, FILE_FULLNAME WHERE SUM(FILE_SIZE) BY OWNER > 100MB

Query Table Listing All Records Where File Size Per Volume Per Owner Exceeds 12 MB

To define a query result table with the following columns: VOLUME_NAME, SFS, OWNER_NAME and lists all the records where total file size per volume per owner exceeds 12 MB, enter the following:

VOLUME_NAME, SUM(FILE_SIZE) AS SFS, OWNER_NAME, WHERE SFS > 12MB

Nodes Where Failed File Backups Greater Than 100

To select all the nodes where total number of failed file backups for all the sessions is greater than 100, enter the following:

TSM_NODE WHERE SUM(TSM_SESSION_OBJECTS_FAILED)> 100

Volumes Exceeding 90 Percent of Largest Volume

To select all the volumes the size of which exceeds 90 percent of the size of the largest volume, enter the following:

VOLUME_NAME WHERE VOLUME_SIZE > 0.9 * MAX(VOLUME_SIZE)

Nodes With Session Where Transfer Rate Higher Than Average

To select all the nodes where there was a session with a transfer rate higher than the average, enter the following:

TSM_NODE WHERE TSM_SESSION_XFER_RATE > AVERAGE(TSM_SESSION_XFER_RATE)