气象用sql语句搜寻极大值等(期待更优语句)

--最高温度 最高温度出现时间 最低温度 最低温度出现时间
select top 1 BCMX,BCMXT from F7471DataTable where bcmx=(select MAX(BCMX) from F7471DataTable where area_Code=1 and (Area_Date between '2015-05-14 08:00:00' and '2015-05-15 11:00:00')) union all select top 1 BCMN,BCMNT from F7471DataTable where bcmx=(select min(BCMN) from F7471DataTable where area_Code=1 and (Area_Date between '2015-05-14 08:00:00' and '2015-05-15 11:00:00'))

--极小值测试
select MIN(bcmn) from F7471DataTable where Area_Date between '2015-05-14 08:00:00' and '2015-05-15 11:00:00'

--统计查询 小时雨量
select SUM(BA) from F7471DataTable where area_Code=1 and (Area_Date between '2015-05-14 08:00:00' and '2015-05-15 11:00:00')

--最小能见度统计 最小时间 最大风速统计 最小风速时间 最大风向统计
select top 1 BTMN,BTMNT from F7471DataTable where BTMN=(select min(BTMN) from F7471DataTable where area_Code=1 and (Area_Date between '2015-05-14 08:00:00' and '2015-05-15 11:00:00')) union all select top 1 AFMX,AFMXT from F7471DataTable where AFMX=(select max(AFMX) from F7471DataTable where area_Code=1 and (Area_Date between '2015-05-14 08:00:00' and '2015-05-15 11:00:00')) union all select top 1 AEMX,AFMXT from F7471DataTable where AEMX=(select max(AEMX) from F7471DataTable where area_Code=1 and (Area_Date between '2015-05-14 08:00:00' and '2015-05-15 11:00:00'))


--最高路面温度 最高路面温度时间 最低路面温度 最低路面温度时间
select top 1 LGHMX,LGHMXT from F7471DataTable where LGHMX=(select MAX(LGHMX) from F7471DataTable where area_Code=1 and (Area_Date between '2015-05-14 08:00:00' and '2015-05-15 13:00:00')) union all select top 1 LGHMN,LGHMNT from F7471DataTable where LGHMN=(select min(LGHMN) from F7471DataTable where area_Code=1 and (Area_Date between '2015-05-14 08:00:00' and '2015-05-15 13:00:00'))

转载于:https://www.cnblogs.com/lierjie/p/4505952.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值