34,837
社区成员




SELECT * FROM
(select case when left(tel,2) in ('01','02') then left(tel,3)
else left(tel,4)
end AS AAA , count(1) BBB
from tb a
where a.bill_time between '2011-03-01 00:00:000' and '2011-03-08 00:00:000'
group by case when left(tel,2) in ('01','02') then left(tel,3)
else left(tel,4)
end) A left join table2 b on a.ars_id=b.ars_id
left join table3 c on b.area_id=c.area_id