SELECT d.homeaddress,
d.householdnum,
d.ownername,
d.homemanber,
d.statepoverty,
d.tuopinshuxing,
d.familytype,
d.holdattribute,
d.maincauses,
d.othercauses,
d.updatetime,
d.isreturnpoverty,
d.flog,
d.rn
FROM (SELECT t.homeaddress,
t.householdnum,
t.ownername,
t.homemanber,
t.statepoverty,
t.tuopinshuxing,
t.familytype,
t.holdattribute,
t.maincauses,
t.othercauses,
t.updatetime,
t.isreturnpoverty,
t.flog,
ROWNUM rn
FROM (SELECT distinct h.householdnum,
h.homeaddress,
h.ownername,
(SELECT "COUNT"("ID")
from POORPEOPLE
where HOUSEHOLDS = h.householdnum) homemanber,
h.statepoverty,
h.tuopinshuxing,
h.familytype,
h.holdattribute,
h.maincauses,
h.othercauses,
h.updatetime,
h.isreturnpoverty,
h.flog
FROM HOUSEHOLDS h, poorpeople p
WHERE h.HOUSEHOLDNUM = p.HOUSEHOLDS
and instr(h.address, '61') = 1
ORDER BY h.updatetime desc nulls last) T
where rownum <= 1 * 5) d
WHERE d.rn >= 1
d.householdnum,
d.ownername,
d.homemanber,
d.statepoverty,
d.tuopinshuxing,
d.familytype,
d.holdattribute,
d.maincauses,
d.othercauses,
d.updatetime,
d.isreturnpoverty,
d.flog,
d.rn
FROM (SELECT t.homeaddress,
t.householdnum,
t.ownername,
t.homemanber,
t.statepoverty,
t.tuopinshuxing,
t.familytype,
t.holdattribute,
t.maincauses,
t.othercauses,
t.updatetime,
t.isreturnpoverty,
t.flog,
ROWNUM rn
FROM (SELECT distinct h.householdnum,
h.homeaddress,
h.ownername,
(SELECT "COUNT"("ID")
from POORPEOPLE
where HOUSEHOLDS = h.householdnum) homemanber,
h.statepoverty,
h.tuopinshuxing,
h.familytype,
h.holdattribute,
h.maincauses,
h.othercauses,
h.updatetime,
h.isreturnpoverty,
h.flog
FROM HOUSEHOLDS h, poorpeople p
WHERE h.HOUSEHOLDNUM = p.HOUSEHOLDS
and instr(h.address, '61') = 1
ORDER BY h.updatetime desc nulls last) T
where rownum <= 1 * 5) d
WHERE d.rn >= 1
解决方案 »
- 求sql1992标准的全连接的语法
- 一个简单的存储过程,希望高手帮我解答!!!
- 请问各位大哥ORA-01403 NO DATA FOUND 的问题
- orracle10的oem按钮乱码
- 关于oracle分布式系统
- 请教如何将SQLSERVER的FUNCTION转换成ORACLE的FUNCTION,谢谢!
- 80分求,oracle如何在不删列数据的情况下从varchar2改为number型
- 请教一个关于移动数据文件的问题
- 高手请进--Oracle的Spatial如何解析出来??
- 为什么我在sql*plus在system表空间建了个scott.sale表后在oem看不见呀!!
- oracle11g新建数据库如何使用EM?
- kettle IO错误 connetion reset怎么破,求教,急。
t.householdnum,
t.ownername,
t.homemanber,
t.statepoverty,
t.tuopinshuxing,
t.familytype,
t.holdattribute,
t.maincauses,
t.othercauses,
t.updatetime,
t.isreturnpoverty,
t.flog,
t.rn
from (select distinct h.householdnum,
h.homeaddress,
h.ownername,
p.cnt,
h.statepoverty,
h.tuopinshuxing,
h.familytype,
h.holdattribute,
h.maincauses,
h.othercauses,
h.updatetime,
h.isreturnpoverty,
h.flog,
row_number()over(order by h.updatetime desc nulls last) rn
from households h
inner join (select t.households,count(id) as cnt from poorpeople group by t.households) p
on p.households = h.householdnum
and instr(h.address, '61') = 1
) t
where t.rn <= 5