select count(1),sum(case when type='sp' then 1 else 0 end) sp, sum(case when type='xp' then 1 else 0 end) xp from tb_t1 where id=1
难道是这样的? select (select count(*) from t1 where id=1), (select count(*) from t1 where id=1 and type='sp'), (select count(*) from t1 where id=1 and type='xp') from dual
select count(1),sum(case when type='sp' then 1 else 0 end) sp,
sum(case when type='xp' then 1 else 0 end) xp from tb_t1 where id=1
select
(select count(*) from t1 where id=1),
(select count(*) from t1 where id=1 and type='sp'),
(select count(*) from t1 where id=1 and type='xp')
from dual