Skip to main content

PQL47 (PQL Function Library - CPM 4.7)

COUNT_TABLE

Applies to: CELONIS 4.0 CELONIS 4.2 CELONIS 4.3 CELONIS 4.4 CELONIS 4.5 CELONIS 4.6 CELONIS 4.7

Description

This aggregate function calculates the number of rows of a specified table.

Syntax
COUNT_TABLE ( table )
NULL handling

NULL values are not counted. If all values of a group are NULL, the result for this group is 0.

Examples

[1] Count the number of rows of a single table.

Query

Column1

COUNT_TABLE ( "Table1" )

Input

Output

Table1

column1 : STRING

column2 : INT

'A'

1

'A'

1

'A'

3

'B'

1

'B'

2

Result

Column1 : INT

5

[2] Count the number of rows of two joined tables. The output is grouped by column1. Within each group, COUNT_TABLE counts the number of rows originating from the requested table.

Query

Column1

"Table1"."column1"

Column2

COUNT_TABLE ( "Table1" )

Column3

COUNT_TABLE ( "Table2" )

Input

Output

Table1

column1 : STRING

column2 : INT

'A'

1

'A'

1

'A'

3

'B'

1

'B'

2

Table2

column1 : STRING

column3 : STRING

'A'

'x'

'B'

'y'

Foreign Keys

Table1.column1

Table2.column1

Result

Column1 : STRING

Column2 : INT

Column3 : INT

'A'

3

1

'B'

2

1

See also: