重庆思庄Oracle、Redhat认证学习论坛
标题: oracle 概念积累 [打印本页]
作者: 王硕 时间: 2015-6-8 20:45
标题: oracle 概念积累
Lag和Lead函数可以在一次查询中取出同一字段的前N行的数据和后N行的值
select *
from (select text,
lag(text, 1) over(order by rownum),
lag(text, 2) over(order by rownum),
lead(text, 1) over(order by rownum),
lead(text, 2) over(order by rownum)
from alert_log)
where text like 'ORA-%'
欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) |
Powered by Discuz! X3.2 |