Oracle中sql语句分组后怎样统计出有多少分组
发布网友
发布时间:2022-04-23 18:40
我来回答
共4个回答
热心网友
时间:2022-04-09 03:01
select id,count(*) from 表名 where id group by id;
下次记着给点分
热心网友
时间:2022-04-09 04:19
再套一层:
select
COUNT(1)
from
(select
a.col1
from
(select
'11'
col1
from
al
union
all
select
'22'
from
al
union
all
select
'33'
from
al
union
all
select
'11'
from
al
union
all
select
'33'
from
al
union
all
select
'22'
from
al
union
all
select
'33'
from
al
union
all
select
'11'
from
al)
a
group
by
a.col1)
t
热心网友
时间:2022-04-09 05:54
学习,学习
热心网友
时间:2022-04-09 07:45
再套一层:
select COUNT(1)
from (select a.col1
from (select '11' col1 from al
union all
select '22' from al
union all
select '33' from al
union all
select '11' from al
union all
select '33' from al
union all
select '22' from al
union all
select '33' from al
union all
select '11' from al) a
group by a.col1) t