oracle问题 急救呀

yanxia611 2009-08-27 07:16:03
现在做一个查询报表,3个表之间的关联,数据有点多,我写的sql:
select distinct
c.afa051 || ' ' || c.afa052 afa052,
b.afa031 || ' ' || b.afa032 afa032,
from fa26 a, fa13 b, fa25 c
where 1 = 1
and ('000000' is null or c.aaa010 = '000000')
and ('' is null or c.afa054 = '')
and a.afa054 = c.afa054
and ('' is null or b.afa030 = '')
and a.afa034 = b.afa034
一直出现扩展temp段,我又增加了表空间,但还是不行,最后测试把distinct去掉,关联可以了,但是加上后面的where条件又 不可以啦,谁出现过类似的情况,给指教指教呀,还有distinct会降低查询速度吗,从我这里看是的,谢谢了
...全文
73 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
yanxia611 2009-08-28
  • 打赏
  • 举报
回复
我要做关联,只不过其他的条件我没有列出来,哈哈,已经知道哪里了,是因为那个临时表空间的问题,谢谢呀
libolibo888 2009-08-28
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 shiyiwan 的回复:]
这个where条件怎么这么诡异,加distinct肯定会降低速度啊,因为它需要每条判断是否有重复记录。
SQL codeselectdistinct
c.afa051||''|| c.afa052 afa052,
b.afa031||''|| b.afa032 afa032,from fa26 a, fa13 b, fa25 cwhere1=1and a.afa054= c.afa054and a.afa034= b.afa034 ;
后面3个条件不懂你要做什么
[/Quote]


赞同很诡异的查询条件。
shiyiwan 2009-08-27
  • 打赏
  • 举报
回复
这个where条件怎么这么诡异,加distinct肯定会降低速度啊,因为它需要每条判断是否有重复记录。
select distinct 
c.afa051 || ' ' || c.afa052 afa052,
b.afa031 || ' ' || b.afa032 afa032,
from fa26 a, fa13 b, fa25 c
where 1 = 1
and a.afa054 = c.afa054
and a.afa034 = b.afa034 ;

后面3个条件不懂你要做什么

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧