having rownum<=10
-->这是什么语发,不通,重写.
-->这是什么语发,不通,重写.
解决方案 »
- pl/sql无法启动问题!!!真奇怪了!!!--急,急,急!!
- 在线急等:请教几条简单的查询SQL语句
- 难度很大的关联查询问题,想了好久
- oracle 的几个概念问题?
- imp命令使用之前一定得先把表drop掉才行吗?
- 有关PL/SQL的异常捕获的两个相关问题:
- sql问题:统计投票数
- oracle 数据库查询问题~求各位oracle指点迷津~最好告诉答案~
- 求教,各位大神~~~A表Clob类型字段转移数据到B表Clob类型字段 ...
- 唯一性约束问题咨询
- 我还是不明白,这个回显是怎么回事?
- 请教!为何我把VFP中的表导入到oracle中后,在sql*plus用select看不到数据?在线等待
(select d.DIQUNAME,substr(b.bno,1,6) as bno,b.bname,b.price,
sum(b.amount) as amount,sum(b.mayang) as mayang
from sales a,sales_mx b,units c,diqus d
where a.sno=b.sno and a.uno=c.uno and c.diqu=d.diqu
and xsbz='1'
and to_char(a.sale_date,'yyyy-mm-dd')>='2003-03-01'
and to_char(a.sale_date,'yyyy-mm-dd')<='2003-03-31'
group by d.DIQUNAME,substr(b.bno,1,6),b.bname,b.price
order by d.DIQUNAME desc,substr(b.bno,1,6) desc,b.bname desc,b.price desc) tab
where tab.nownum<=10
select tab.zz,tab.bno,tab.yy,tab.xx,tab.amount,tab.mayang from
(select d.DIQUNAME zz,substr(b.bno,1,6) bno,b.bname yy,b.price xx,
sum(b.amount) amount,sum(b.mayang) mayang
from sales a,sales_mx b,units c,diqus d
where a.sno=b.sno and a.uno=c.uno and c.diqu=d.diqu
and xsbz='1'
and to_char(a.sale_date,'yyyy-mm-dd')>='2003-03-01'
and to_char(a.sale_date,'yyyy-mm-dd')<='2003-03-31'
group by d.DIQUNAME,substr(b.bno,1,6),b.bname,b.price
order by d.DIQUNAME desc,substr(b.bno,1,6) desc,b.bname desc,
b.price desc) tab
where tab.nownum<=10
where tab.nownum<=10改为:
where rownum<=10。
程序运行没错,但有一个问题,只取了10条纪录,而不是每个地区取10条纪录。
insert into cdz_dqtstjb(DIQUNAME,bno,bname,price,amount,mayang)
select tab.zz,tab.bno,tab.yy,tab.xx,tab.amount,tab.mayang from
(select d.DIQUNAME zz,substr(b.bno,1,6) bno,b.bname yy,b.price xx,
sum(b.amount) amount,sum(b.mayang) mayang
from sales a,sales_mx b,units c,diqus d
where a.sno=b.sno and a.uno=c.uno and c.diqu=d.diqu
and xsbz='1'
and to_char(a.sale_date,'yyyy-mm-dd')>='2003-03-01'
and to_char(a.sale_date,'yyyy-mm-dd')<='2003-03-31'
and d.DIQUNAME='丰台区'
order by d.DIQUNAME desc,substr(b.bno,1,6) desc,b.bname desc,b.price desc) tab
where nownum<=10把'丰台区'改为你知道的区,有几个区就执行几次吧。