ClickHouse/tests/queries/0_stateless/00334_column_aggregate_function_limit.sql

10 lines
200 KiB
MySQL
Raw Normal View History

DROP TABLE IF EXISTS ontime;
2016-06-21 21:48:04 +00:00
CREATE TABLE ontime (FlightDate Date, Carrier String, FlightNum String) ENGINE = Memory;
2016-06-21 21:48:04 +00:00
INSERT INTO ontime VALUES ('1987-10-01','AA','2'),('1987-10-01','AA','2'),('1987-10-01','AA','7'),('1987-10-01','AA','7'),('1987-10-01','AA','26'),('1987-10-01','AA','34'),('1987-10-01','AA','36'),('1987-10-01','AA','91'),('1987-10-01','AA','101'),('1987-10-01','AA','101'),('1987-10-01','AA','109'),('1987-10-01','AA','109'),('1987-10-01','AA','112'),('1987-10-01','AA','123'),('1987-10-01','AA','160'),('1987-10-01','AA','165'),('1987-10-01','AA','165'),('1987-10-01','AA','165'),('1987-10-01','AA','176'),('1987-10-01','AA','176'),('1987-10-01','AA','176'),('1987-10-01','AA','176'),('1987-10-01','AA','179'),('1987-10-01','AA','179'),('1987-10-01','AA','215'),('1987-10-01','AA','215'),('1987-10-01','AA','231'),('1987-10-01','AA','231'),('1987-10-01','AA','263'),('1987-10-01','AA','263'),('1987-10-01','AA','268'),('1987-10-01','AA','268'),('1987-10-01','AA','281'),('1987-10-01','AA','287'),('1987-10-01','AA','287'),('1987-10-01','AA','309'),('1987-10-01','AA','309'),('1987-10-01','AA','309'),('1987-10-01','AA','341'),('1987-10-01','AA','344'),('1987-10-01','AA','344'),('1987-10-01','AA','347'),('1987-10-01','AA','347'),('1987-10-01','AA','368'),('1987-10-01','AA','381'),('1987-10-01','AA','381'),('1987-10-01','AA','381'),('1987-10-01','AA','396'),('1987-10-01','AA','396'),('1987-10-01','AA','397'),('1987-10-01','AA','397'),('1987-10-01','AA','417'),('1987-10-01','AA','417'),('1987-10-01','AA','446'),('1987-10-01','AA','451'),('1987-10-01','AA','451'),('1987-10-01','AA','460'),('1987-10-01','AA','460'),('1987-10-01','AA','491'),('1987-10-01','AA','504'),('1987-10-01','AA','504'),('1987-10-01','AA','519'),('1987-10-01','AA','519'),('1987-10-01','AA','523'),('1987-10-01','AA','523'),('1987-10-01','AA','525'),('1987-10-01','AA','525'),('1987-10-01','AA','525'),('1987-10-01','AA','533'),('1987-10-01','AA','533'),('1987-10-01','AA','533'),('1987-10-01','AA','546'),('1987-10-01','AA','546'),('1987-10-01','AA','556'),('1987-10-01','AA','556'),('1987-10-01','AA','556'),('1987-10-01','AA','597'),('1987-10-01','AA','597'),('1987-10-01','AA','597'),('1987-10-01','AA','601'),('1987-10-01','AA','601'),('1987-10-01','AA','627'),('1987-10-01','AA','670'),('1987-10-01','AA','673'),('1987-10-01','AA','673'),('1987-10-01','AA','680'),('1987-10-01','AA','680'),('1987-10-01','AA','817'),('1987-10-01','AA','817'),('1987-10-01','AA','824'),('1987-10-01','AA','824'),('1987-10-01','AA','824'),('1987-10-01','AA','824'),('1987-10-01','AA','832'),('1987-10-01','AA','832'),('1987-10-01','AA','852'),('1987-10-01','AA','852'),('1987-10-01','AA','866'),('1987-10-01','AA','866'),('1987-10-01','AA','871'),('1987-10-01','AA','871'),('1987-10-01','AA','880'),('1987-10-01','AA','880'),('1987-10-01','AA','880'),('1987-10-01','AA','880'),('1987-10-01','AA','883'),('1987-10-01','AA','883'),('1987-10-01','AA','885'),('1987-10-01','AA','885'),('1987-10-01','AA','885'),('1987-10-01','AA','890'),('1987-10-01','AA','893'),('1987-10-01','AA','893'),('1987-10-01','AA','905'),('1987-10-01','AA','905'),('1987-10-01','AA','929'),('1987-10-01','AA','929'),('1987-10-01','AA','936'),('1987-10-01','AA','936'),('1987-10-01','AA','937'),('1987-10-01','AA','937'),('1987-10-01','AA','955'),('1987-10-01','AA','966'),('1987-10-01','AA','1002'),('1987-10-01','AA','1002'),('1987-10-01','AA','1004'),('1987-10-01','AA','1004'),('1987-10-01','AA','1015'),('1987-10-01','AA','1015'),('1987-10-01','AA','1021'),('1987-10-01','AA','1021'),('1987-10-01','AA','1041'),('1987-10-01','AA','1041'),('1987-10-01','AA','1046'),('1987-10-01','AA','1046'),('1987-10-01','AA','1048'),('1987-10-01','AA','1048'),('1987-10-01','AA','1061'),('1987-10-01','AA','1061'),('1987-10-01','AA','1088'),('1987-10-01','AA','1088'),('1987-10-01','AA','2033'),('1987-10-01','AA','2033'),('1987-10-01','AA','2050'),('1987-10-01','AA','2058'),('1987-10-01','AA','2071'),('1987-10-01','AA','2071'),('1987-10-01','AA','2086'),('1987-10-01','AA','2105'),('1987-10-01','AA','2111'),('1987-10-01','AA','2123'),('1987-10-01','AA','2123'),('1987-10-01','AA','2147'),('1987-10-01','AA','2147'),('1987-10-01','AA','2199'),('1987-10-01','AA',
2016-06-21 21:48:04 +00:00
SELECT ignore(finalizeAggregation(Users)) FROM (SELECT FlightDate, Carrier, uniqState(FlightNum) AS Users FROM ontime GROUP BY FlightDate, Carrier LIMIT 1);
2016-06-21 21:48:04 +00:00
DROP TABLE ontime;