zoukankan      html  css  js  c++  java
  • 取上下限值 思路

    ----将数据从小到大取出
    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();

  • 相关阅读:
    jQuery 选择器
    http statusCode(状态码)含义
    JS实现拖拽效果
    Sql Service中的分页
    SQL Server中一些不常见的查询
    游标的基本写法
    doT.js
    关于GridView中控件的问题
    Sql Server创建函数
    ASP.NET中Ajax的用法
  • 原文地址:https://www.cnblogs.com/lj821022/p/7061413.html
Copyright © 2011-2022 走看看