城市排名列表

SELECT c.sheng ,m.city, RANK() OVER (ORDER BY round(avg(cast(indexs as float)),3)) AS px,
round(avg(cast(pm25 as float)),0) pm25, round(avg(cast(pm10 as float)),0) pm10, round(avg(cast(co as float)),3) co,
round(avg(cast(no2 as float)),0) no2, round(avg(cast(so2 as float)),0) so2,round(avg(cast(o3_8 as float)),0) o3_8,round(avg(cast(indexs as float)),3) indexs,round(avg(cast(aqi as float)),0) aqi
FROM monitor_city_hour m,cd_city c
where m.city=c.city and
datetime='2017-03-04 12:00:00' and aqi!=0 and pm25!=0 and pm25 is not null
group by c.sheng,m.city
order by indexs

某城市一段时间的排名曲线

 select fdate time,px,aqi from(
SELECT fdate,city,RANK() OVER (partition by fdate ORDER BY aqi) AS px,aqi
FROM monitor_city_day
where aqi!=0 and pm25!=0 and pm25 is not null
and cast(fdate as datetime)>=cast('2017-02-01' as datetime) and
cast(fdate as datetime)<=cast('2017-03-05' as datetime)
)a where city='北京'
order by cast(fdate as datetime)

sql server 数据排名的更多相关文章

  1. SQL Server中排名函数row_number,rank,dense_rank,ntile详解

    SQL Server中排名函数row_number,rank,dense_rank,ntile详解 从SQL SERVER2005开始,SQL SERVER新增了四个排名函数,分别如下:1.row_n ...

  2. SQL server数据缓存依赖

    SQL server数据缓存依赖有两种实现模式,轮询模式,通知模式. 1  轮询模式实现步骤 此模式需要SQL SERVER 7.0/2000/2005版本以上版本都支持        主要包含以下几 ...

  3. [SQL]SQL Server数据表的基础知识与增查删改

    SQL Server数据表的基础知识与增查删改 由张晨辉(学生) 于19天 前发表 | 阅读94次 一.常用数据类型 .整型:bigint.int.smallint.tinyint .小数:decim ...

  4. Sql Server数据的加密与解密

    Sql Server数据的加密与解密 在sql server中,我们如何为数据进行加密与解密,避免使用者窃取机密数据? 对于一些敏感数据,如密码.卡号,一般不能使用正常数值来存储.否则会有安全隐患.以 ...

  5. delphi 2010 导出sql server 数据到DBF乱码问题

    近日,由于业务需要导出sql server 数据到DBF文件,要查询多表记录,并适当处理后生成导出DBF文件,系统使用delphi2010平台开发. 首先按要求在VFP里创建DBF表,字段数有240个 ...

  6. SQL server数据库内置账户SA登录设置

    SQL server数据库内置账户SA登录不了   设置SQL Server数据库给sa设置密码的时候  提示18456 解决步骤:   第二步:右击sa,选择属性: 第三步:点击状态选项卡:勾选授予 ...

  7. SQL Server 复制 - 发布订阅(SQL Server 数据同步)

    原文:SQL Server 复制 - 发布订阅(SQL Server 数据同步) SQL Server的同步是通过SQL Server自带的复制工具来实现的,分发布和订阅2大步. A,复制-发布 发布 ...

  8. (Sql Server)数据的拆分和合并

    (Sql Server)数据的拆分和合并 背景: 今天遇到了数据合并和拆分的问题,尝试了几种写法.但大致可分为两类:一.原始写法.二.Sql Server 2005之后支持的写法.第一种写法复杂而且效 ...

  9. SQL Server数据转MySql

    正好用到SQL Server数据转MySql的知识,就分享一下, 准备:需要用到  Navicat Premium 百度上下载就好 1.打开连接MySQL数据库,新建数据库,双击数据库点击导入 2.导 ...

随机推荐

  1. geotrellis使用(三十二)大量GeoTiff文件实时发布TMS服务

    前言 在上一篇文章中我讲了如何直接将Geotiff文件发布为TMS服务,在其中只讲了单幅Geotiff的操作,其实单幅这种量级的数据对Geotrellis来说就是杀鸡焉用牛刀,Geotrellis针对 ...

  2. 基于pandas python的美团某商家的评论销售数据分析(可视化)

    基于pandas python的美团某商家的评论销售数据分析 第一篇 数据初步的统计 本文是该可视化系列的第二篇 第三篇 数据中的评论数据用于自然语言处理 导入相关库 from pyecharts i ...

  3. flask跨域请求

    跨域文件上传的时候,浏览器会自动发起一个 OPTIONS 方法到服务器,现在后台解决前端跨域解决前端跨域请求的问题 客户端发起的这个 OPTIONS 可以说是一个“预请求”,用于探测后续真正需要发起的 ...

  4. linux写文件,追加内容

    覆盖文件 echo "hello" > filename 追加文件 echo "haha" >> filename

  5. 360浏览器设置打开默认为chrome极速模式

    <meta name="renderer" content="webkit"> 若页面需默认用ie兼容内核,增加标签: <meta name= ...

  6. ELK之filebeat-redis-logstash-es构架模式

    下载filebeat的rpm包安装filebeat wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.3.0- ...

  7. Nginx设置网站维护页面

    网站升级需要停服,可以在Nginx设置静态页面设置强制跳转 修改nginx配置文件nginx.conf http { sendfile on; keepalive_timeout 65; server ...

  8. FZU 2092 收集水晶(记忆化搜索)

    Problem 2092 收集水晶 Accept: 101 Submit: 439 Time Limit: 5000 mSec Memory Limit : 32768 KB Problem Desc ...

  9. 一个sfm开源项目

    Structure from Motion 资料总结 https://blog.csdn.net/u014636245/article/details/77527627 github上用opencv实 ...

  10. codeforces 586B/C

    题目链接:http://codeforces.com/contest/586/problem/B B. Laurenty and Shop time limit per test 1 second m ...