首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 企业软件 > 行业软件 >

DBA,复杂的存储过程

2012-04-26 
求助DBA,复杂的存储过程表结构create table db1(devno varchar2(10), --设备号码valuevarchar2(10), --值t

求助DBA,复杂的存储过程
表结构

create table db1(

 devno varchar2(10), --设备号码
 value varchar2(10), --值
 time date, --数据保存时间

)

需求 :统计今年每个月该表值为1-5,5-10,10-15的记录数,转存到另外一张表。转存表记录设备号,记录数,值,时间。

[解决办法]
insert into tbname 
select '1-5',count(*)
from tb
where value between 1 and 5;

insert into tbname 
select '1-5',count(*)
from tb
where value between 5 and 10;

insert into tbname 
select '1-5',count(*)
from tb
where value between 10 and 15;

热点排行