select a.serialno,a.srtypeid,a.servicecontent, a.contactchannel,b.HANDLINGCOMMENT
from t_pbh_problemprocess a,t_pbh_problemworkitem b
where a.serialno=a.serialno;
去掉 a.serialno,a.srtypeid 重复的
from t_pbh_problemprocess a,t_pbh_problemworkitem b
where a.serialno=a.serialno;
去掉 a.serialno,a.srtypeid 重复的
解决方案 »
- 如何将oracle816升级到oracle8.1.7.4
- dept.deptno=emp.deptno(+)表示什么意义?
- 求 toad for oracle 的教程,谢谢~~
- CLOB存取问题,急!
- oracle论坛cnoug怎么登不上去了?
- 再线请教一SQL*LODER问题
- 怎么屏蔽和开启索引?
- 为什么索引失效?急,在线等待
- 如何用sql实现从一个表条件查询,然后结果直接插入另一张表?一条语句实现。
- 急!!!!!
- oracle数据迁移
- 字段值格式如下(001,2|002,2|005,3),要怎样快速的找到该字段中包含值为002,2的记录,该表中的数据量较大(百万起步),除like外有没其它方法
select max(a.serialno),max(a.srtypeid),a.servicecontent,
a.contactchannel,b.HANDLINGCOMMENT
from t_pbh_problemprocess a,t_pbh_problemworkitem b
where a.serialno=b.serialno
group by a.servicecontent, a.contactchannel,b.HANDLINGCOMMENT;
select serialno,srtypeid,servicecontent,contactchannel,HANDLINGCOMMENT from (
select a.serialno,a.srtypeid,a.servicecontent, a.contactchannel,b.HANDLINGCOMMENT,row_number()over(partition by a.serialno,a.srtypeid order by a.serialno,a.srtypeid) rn
from t_pbh_problemprocess a,t_pbh_problemworkitem b
where a.serialno=b.serialno;
)
where rn=1;
我觉得不存在去a.serialno,a.srtypeid重复的问题,直接
select distinct a.serialno,a.srtypeid,a.servicecontent, a.contactchannel,b.HANDLINGCOMMENT
from t_pbh_problemprocess a,t_pbh_problemworkitem b
where a.serialno=a.serialno;
from t_pbh_problemprocess a,t_pbh_problemworkitem b
WHERE a.serialno=a.serialno
GROUP By a.serialno,a.srtypeid,a.servicecontenta.contactchannel,b.HANDLINGCOMMENT;
我写成这样,当由于数据太大,出不来
select distinct a.serialno,a.srtypeid,a.servicecontent, a.contactchannel,b.HANDLINGCOMMENT
from t_pbh_problemprocess a,t_pbh_problemworkitem b
where a.serialno=a.serialno;我试了数据太大出不来
--由于你两个字段在同一个表中,先去掉重复的,再连接:
--另外,你t_pbh_problemprocess 表和t_pbh_problemworkitem 表的serialno字段增加索引
select a.serialno,a.srtypeid,a.servicecontent, a.contactchannel,b.HANDLINGCOMMENT
from t_pbh_problemworkitem b,(
select a.* ,row_number()over(partition by a.serialno,a.srtypeid order by a.serialno,a.srtypeid) rn
from t_pbh_problemprocess a
where a.serialno=b.serialno) a
)
where a.rn=1
and exsits(select 1 from t_pbh_problemprocess a where a.serialno=b.serialno)
select a.serialno,a.srtypeid,a.servicecontent, a.contactchannel,b.HANDLINGCOMMENT,row_number()over(partition by a.serialno,a.srtypeid order by a.serialno,a.srtypeid) rn
from t_pbh_problemprocess a,t_pbh_problemworkitem b
where a.serialno=b.serialno;
)
where rn=1;
这条语句很快,几百万数据很快出来,我第一开始也想用的,不过不知道什么意思?
楼主是这样的where a.serialno=a.serialno
from t_pbh_problemprocess a,t_pbh_problemworkitem b
where a.serialno=b.serialno;
你再执行下这个,注意红字部分,是你把b写成a了,这个肯定快啊
from t_pbh_problemprocess a) t
用* 会报错分类太长,说字段都要加上
from
(select a.serialno,a.srtypeid,a.servicecontent, a.contactchannel,b.HANDLINGCOMMENT,
row_number() over(partition by a.serialno,a.srtypeid order by a.serialno,a.srtypeid) rn
from t_pbh_problemprocess a,t_pbh_problemworkitem b
where a.serialno=a.serialno)
where rn=1
那你也太强了
去重的话 分析函数不错 貌似用rowid也不错哦