cartodb-postgresql/test/CDB_EqualIntervalBinsTest.sql

12 lines
433 B
MySQL
Raw Normal View History

2015-05-15 03:32:58 +08:00
WITH data AS (
2015-05-19 00:00:42 +08:00
SELECT array_agg(x::numeric) s FROM generate_series(1,300) x
2015-05-15 03:32:58 +08:00
WHERE x % 5 != 0 AND x % 7 != 0
)
SELECT round(unnest(CDB_EqualIntervalBins(s, 7)),7) FROM data;
WITH data_nulls AS (
SELECT array_agg(CASE WHEN x % 2 != 0 THEN x ELSE NULL END::numeric) s FROM generate_series(1,100) x
WHERE x % 5 != 0 AND x % 7 != 0
)
SELECT round(unnest(CDB_EqualIntervalBins(s, 7)),7) FROM data_nulls;