有两个查询语句,查询功能一样,但是一个正常,一个报错:无法通过128(在表空间TEMP中)扩展 temp 段
正常的是:
select u.unitname, m.* from unit_info_tab u, (select count(*) as total, b.unitid as unitid,
sum(case when b.stateid ='3' then 1 else 0 end) as weiwancheng,
sum(case when b.stateid in ('1','6') then 1 else 0 end) as wancheng,
sum(case when a.eventnum Like '0101%' then 1 else 0 end) as shironghuanjing,
sum(case when a.eventnum Like '0102%' then 1 else 0 end) as xuanchuanguanggao,
sum(case when a.eventnum Like '0103%' then 1 else 0 end) as shigongguanli,
sum(case when a.eventnum Like '0105%' then 1 else 0 end) as jiemianzhixu,
sum(case when a.eventnum Like '0104%' then 1 else 0 end) as tufashijian,
sum(case when a.eventnum in ('0201%','0202%','0203%','0204%','0205%','0206%') then 1 else 0 end) as bujian,
sum(case when a.eventnum Like '05%' then 1 else 0 end) as other,
sum(case when a.eventnum Like '03%' then 1 else 0 end) as zhianfangkong,
sum(case when b.stateid in ('6') then 1 else 0 end) as daxunhuan,
(count(*) - sum(case when b.stateid in ('6') then 1 else 0 end)) as xiaoxunhuan
From event_tab b,event_type_tab a