oracle row_number() 使用
2016-02-23 17:05
411 查看
select *
from (select row_number() over(partition by date1, no1, no2, no3, no4, no5 order by time1 DESC) r,
t.*
from table1 t)
where r = 1
与
select date1, no1, no2, no3, no4, no5, count(1)
from table1 t
group by date1, no1, no2, no3, no4, no5
having count(1) > 0
返回的结果条数相同
from (select row_number() over(partition by date1, no1, no2, no3, no4, no5 order by time1 DESC) r,
t.*
from table1 t)
where r = 1
与
select date1, no1, no2, no3, no4, no5, count(1)
from table1 t
group by date1, no1, no2, no3, no4, no5
having count(1) > 0
返回的结果条数相同
相关文章推荐
- 执行oracle的存储过程
- 开发语言 .net c# java objective-c 数据库SQL ORACLE 操作系统 QQ群 77763608
- Oracle 批量insert报错处理
- oracle 字段用逗号隔开函数
- oracle设置定时执行存储过程
- oracle日志位置
- 降低oracle高水位线方法总结(包括验证结果)
- oracle 定义游标的时候使用变量作为表名
- 关于oracle sql语句查询时表名和字段名要加双引号的问题详解
- oracle11g 修改字符集 修改为ZHS16GBK
- Oracle 中使用正则表达式
- oracle后台进程
- Oracle导入备份库
- 客户端DNS配置
- Oracle Study之--AIX install RAC运行root.sh(PRKR-1062)错误
- Oracle Study之--AIX install RAC运行root.sh(PRKR-1062)错误
- 通过python将MySQL,Oracle查询的数据存到Excel文件
- 方便连接操作Mysql、Oracle、Sqlserver数据库的一个类库
- 数据库迁移之从oracle 到 MySQL
- Oracle varchar2 4000