select count(*) over(partition by col1) from tmp_test;
展示每一行中,根据col1分组的数量。类似于
select count(8) from tmp_test group by col1;
只不过每一行,都展示分组结果。还可以根据多列分组
select count(*) over(partition by col1,col2) from tmp_test;
select count(*) over(partition by col1) from tmp_test;
展示每一行中,根据col1分组的数量。类似于
select count(8) from tmp_test group by col1;
只不过每一行,都展示分组结果。还可以根据多列分组
select count(*) over(partition by col1,col2) from tmp_test;