select count(b.mobileno) as 参与次数 ,max(case when custtype='中奖客户' then b.mobileno else null end)as 手机号,count(case when custtype='中奖客户' then b.mobileno else null end) as 中奖次数
from t_base b
group by b.mobileno
from t_base b
group by b.mobileno
sum( case when XX then 1 else 0 end)
group by XX
order by XX
from t_base b
where b.custtype='中奖客户'
group by b.mobileno
from t_base b
where b.custtype='中奖客户'
group by b.mobileno