取上下限值 思路

Posted 小牛爸

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了取上下限值 思路相关的知识,希望对你有一定的参考价值。

----将数据从小到大取出
select value from HistoryData hisdata0_ where 1=1 and hisdata0_.devId=112
and hisdata0_.enname=‘pressure‘ and (hisdata0_.startTime between ‘2017-01-01 00:00:00‘ and ‘2017-04-05 00:00:00‘)  --原始数据的时间范围
and isnumeric(hisdata0_.value)=1 and (cast(hisdata0_.value as float) between 0 and 1)           --数据过滤
and (cast(datepart(hour, hisdata0_.startTime) as varchar(255))+‘:‘+cast(datepart(minute,
hisdata0_.startTime) as varchar(255)))=‘0:15‘  --时间匹配

order by Cast(value as float) asc            从小到大排序

----根据上下限比率算出上下限位置

upperNo =(int)( allNum * upperLimitRate );   //allNum为总数据记录条数,
lowerNo=(int)( allNum * lowerLimitRate );      

 

-- 取最大值,最小值

query2.setFirstResult(upperNo);
query2.setMaxResults(1);
max = query2.list();

query2.setFirstResult(lowerNo);
query2.setMaxResults(1);
min = query2.list();

以上是关于取上下限值 思路的主要内容,如果未能解决你的问题,请参考以下文章

触摸屏点餐软件开发过程中的挂单取单编程思路视频课程

Centos系统 上下文切换的检查思路

爬取豆瓣电影排名的代码以及思路

经典动态规划总结

Too many open files (CLOSE_WAIT过多)的解决方案:修改打开文件数的上限值调整TCP/IP的参数

爬虫技术:爬取淘宝美食数据:崔庆才思路