Last updated 4 months ago
The SUM function returns the sum of the input column or expression values. ()
SUM ( [ DISTINCT | ALL ] expression )
This function is fully supported by .
CREATE TABLE test_sum_function ( col1 INT ); INSERT INTO test_sum_function VALUES ('200'), ('20'), ('2'), ('2'); SELECT SUM(COL1), SUM(DISTINCT COL1), SUM(ALL COL1) FROM test_sum_function;
224
222
Output Code:
CREATE TABLE test_sum_function ( col1 INT ) COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "redshift", "convertedOn": "11/20/2024", "domain": "test" }}'; INSERT INTO test_sum_function VALUES ('200'), ('20'), ('2'), ('2'); SELECT SUM(COL1), SUM(DISTINCT COL1), SUM(ALL COL1) FROM test_sum_function;
There are no known issues.