Created
May 26, 2010 01:53
-
-
Save saberma/413945 to your computer and use it in GitHub Desktop.
oracle常用SQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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