2022-10-12 16:50:56 +00:00
|
|
|
DROP TABLE IF EXISTS group_by_all;
|
|
|
|
|
|
|
|
CREATE TABLE group_by_all
|
|
|
|
(
|
2022-10-20 10:03:00 +00:00
|
|
|
a String,
|
2022-10-21 07:07:42 +00:00
|
|
|
b int,
|
|
|
|
c int
|
2022-10-12 16:50:56 +00:00
|
|
|
)
|
|
|
|
engine = Memory;
|
|
|
|
|
2022-10-21 07:07:42 +00:00
|
|
|
insert into group_by_all values ('abc1', 1, 1), ('abc2', 1, 1), ('abc3', 1, 1), ('abc4', 1, 1);
|
2022-10-12 16:50:56 +00:00
|
|
|
|
2022-10-22 11:45:03 +00:00
|
|
|
select a, count(b) from group_by_all group by all order by a;
|
2022-10-20 10:03:00 +00:00
|
|
|
select substring(a, 1, 3), count(b) from group_by_all group by all;
|
|
|
|
select substring(a, 1, 3), substring(substring(a, 1, 2), 1, count(b)) from group_by_all group by all;
|
2022-10-21 07:07:42 +00:00
|
|
|
select substring(a, 1, 3), substring(substring(a, 1, 2), c, count(b)) from group_by_all group by all;
|
|
|
|
select substring(a, 1, 3), substring(substring(a, c, 2), c, count(b)) from group_by_all group by all;
|
|
|
|
select substring(a, 1, 3), substring(substring(a, c + 1, 2), 1, count(b)) from group_by_all group by all;
|
|
|
|
select substring(a, 1, 3), substring(substring(a, c + 1, 2), c, count(b)) from group_by_all group by all;
|
|
|
|
select substring(a, 1, 3), substring(substring(substring(a, c, count(b)), 1, count(b)), 1, count(b)) from group_by_all group by all;
|
2022-10-20 10:03:00 +00:00
|
|
|
select substring(a, 1, 3), substring(a, 1, count(b)) from group_by_all group by all;
|
2022-10-20 12:37:52 +00:00
|
|
|
select count(b) AS len, substring(a, 1, 3), substring(a, 1, len) from group_by_all group by all;
|