文章标题
发布时间:2020-12-12 16:30:26 所属栏目:百科 来源:网络整理
导读:场景: a0表是a表的源表。a表每天都把a0表的全部数据拿过来插入。(因此a的数据量很大,一般需要创建相应的索引) 假设t4是类似于日期的字段,需要找到t1,t2两个查询条件下的对象在一系列t4下的变动记录。 举例: T1 T2 T3 T4 1 1 1 1 1 1 1 2 1 1 2 3 1 1 2
场景: select aa.* from (select rownum as rn,a.* from (select t1,t2,t3,t4 from t where t1='t1' and t2='t2'order by t4 asc) a)aa,(select rownum as rn,b.* from (select t1,t4 from t where t1='t1' and t2='t2'order by t4 asc) b)bb where (aa.rn=bb.rn+1 and aa.t3<>bb.t3) or (aa.rn=1 and bb.rn=1) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |