sql server 数据排名
城市排名列表
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 数据排名的更多相关文章
- SQL Server中排名函数row_number,rank,dense_rank,ntile详解
SQL Server中排名函数row_number,rank,dense_rank,ntile详解 从SQL SERVER2005开始,SQL SERVER新增了四个排名函数,分别如下:1.row_n ...
- SQL server数据缓存依赖
SQL server数据缓存依赖有两种实现模式,轮询模式,通知模式. 1 轮询模式实现步骤 此模式需要SQL SERVER 7.0/2000/2005版本以上版本都支持 主要包含以下几 ...
- [SQL]SQL Server数据表的基础知识与增查删改
SQL Server数据表的基础知识与增查删改 由张晨辉(学生) 于19天 前发表 | 阅读94次 一.常用数据类型 .整型:bigint.int.smallint.tinyint .小数:decim ...
- Sql Server数据的加密与解密
Sql Server数据的加密与解密 在sql server中,我们如何为数据进行加密与解密,避免使用者窃取机密数据? 对于一些敏感数据,如密码.卡号,一般不能使用正常数值来存储.否则会有安全隐患.以 ...
- delphi 2010 导出sql server 数据到DBF乱码问题
近日,由于业务需要导出sql server 数据到DBF文件,要查询多表记录,并适当处理后生成导出DBF文件,系统使用delphi2010平台开发. 首先按要求在VFP里创建DBF表,字段数有240个 ...
- SQL server数据库内置账户SA登录设置
SQL server数据库内置账户SA登录不了 设置SQL Server数据库给sa设置密码的时候 提示18456 解决步骤: 第二步:右击sa,选择属性: 第三步:点击状态选项卡:勾选授予 ...
- SQL Server 复制 - 发布订阅(SQL Server 数据同步)
原文:SQL Server 复制 - 发布订阅(SQL Server 数据同步) SQL Server的同步是通过SQL Server自带的复制工具来实现的,分发布和订阅2大步. A,复制-发布 发布 ...
- (Sql Server)数据的拆分和合并
(Sql Server)数据的拆分和合并 背景: 今天遇到了数据合并和拆分的问题,尝试了几种写法.但大致可分为两类:一.原始写法.二.Sql Server 2005之后支持的写法.第一种写法复杂而且效 ...
- SQL Server数据转MySql
正好用到SQL Server数据转MySql的知识,就分享一下, 准备:需要用到 Navicat Premium 百度上下载就好 1.打开连接MySQL数据库,新建数据库,双击数据库点击导入 2.导 ...
随机推荐
- Accelerated Failure Time Models加速失效时间模型AFT
Weibull distribution 或者 σ是未知的scale参数,独立于X的常量, σ>0 是服从某一分布的随机变量 残差(residuals)=
- [分布式系统学习]阅读笔记 Distributed systems for fun and profit 抽象 之二
本文是阅读 http://book.mixu.net/distsys/abstractions.html 的笔记. 第二章的题目是"Up and down the level of abst ...
- vs附加调试 w3p进程没有名称
解决: 把vs用管理员运行
- Zookeeper可以干什么
在Zookeeper的官网上有这么一句话:ZooKeeper is a centralized service for maintaining configuration information, n ...
- Node.js(daemon),tweak(debug ES)/nodejs forever,supervisor--express
http://www.cnblogs.com/Darren_code/p/node_express.html express -e nodejs-product sudo npm install fo ...
- Python实现简单HTTP服务器(一)
一.返回固定内容 # coding:utf-8 import socket from multiprocessing import Process def handle_client(client_s ...
- 字符编码笔记:ASCII,Unicode和UTF-8(转载)
注:我注释的地方有 add by zhj.另Unicode.UTF-8.GB2312查询http://www.2fz1.com/so/ 在python中,a.decode(xxx)就是把str类型的字 ...
- form表单的enctype属性
①application/x-www-form-urlencoded : 数据被编码为名称/值对. ②multipart/form-data : 数据被编码为一条消息,页上的每个控件对应消息中的一个部 ...
- 【Pyton】【小甲鱼】爬虫4-XXOO
import urllib.request import os def open_url(url): req=urllib.request.Request(url) req.add_header('U ...
- beginAppearanceTransition
- (void)beginAppearanceTransition:(BOOL)isAppearing animated:(BOOL)animated __OSX_AVAILABLE_STARTING ...