mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 17:44:23 +00:00
1.0 KiB
1.0 KiB
toc_priority |
---|
144 |
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 the number of rows with not-NULL values.
Type: Tuple.
Example
Query:
CREATE TABLE s_table (x Int8) Engine = Log;
INSERT INTO s_table SELECT number FROM numbers(0, 20);
INSERT INTO s_table VALUES (NULL);
SELECT sumCount(x) from s_table;
Result:
┌─sumCount(x)─┐
│ (190,20) │
└─────────────┘
See also
- optimize_fuse_sum_count_avg setting.