Skip to content

Instantly share code, notes, and snippets.

@rainly
Forked from saberma/Oracle_Fast_Delete.sql
Created March 17, 2011 10:20
Show Gist options
  • Save rainly/874112 to your computer and use it in GitHub Desktop.
Save rainly/874112 to your computer and use it in GitHub Desktop.
create table pop_temp_all as
select * from pop_populate;
create table pop_temp as
select * from pop_populate
where stroffice='440305008000';
alter table pop_populate disable primary key cascade;
truncate table pop_populate;
insert into pop_populate
select * from pop_temp ;
commit;
alter table pop_populate enable primary key;
drop table pop_temp;
select sb.id, sb.buildingcode,concat(su.uptownname, sb.buildingname)
,( select count(zh.id)
from zul_hireperson zh
where zh.buildingid=sb.id and zh.isdepart='0'
)
,( select count(zh.id)
from zul_hireperson zh
where zh.orgtype='1' and zh.buildingid=sb.id and zh.isdepart='0'
)
,( select count(zh.id)
from zul_hireperson zh
where zh.orgtype='2' and zh.regaddtype<='3' and zh.buildingid=sb.id and zh.isdepart='0'
)
,( select count(zh.id)
from zul_hireperson zh
where zh.orgtype='2' and zh.regaddtype>'3' and zh.buildingid=sb.id and zh.isdepart='0'
)
from sq_building sb, sq_uptown su
where sb.uptownid=su.id and su.communitee='440305008011' and sb.id=1342
group by su.uptownname,sb.id, sb.buildingcode,sb.buildingname
order by su.uptownname,sb.buildingcode,sb.buildingname
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment