mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-29 05:00:47 +00:00
1003 B
1003 B
toc_priority |
---|
142 |
sumCount
Calculates the sum of the numbers and counts the number of rows at the same time.
Syntax
sumCount(x)
Arguments
Returned value
- Tuple
(sum, count)
, wheresum
is the sum of numbers andcount
is a counts the number of rows or not-NULL values.
Type: Tuple.
Example
Query:
CREATE TABLE test (x Int8) Engine = Log;
INSERT INTO test SELECT number FROM numbers(1, 20);
SELECT sumCount(x) from test;
Result:
┌─sumCount(a)─┐
│ (210,20) │
└─────────────┘
See also
- optimize_fuse_sum_count_avg setting.