要怎样才能把所有数据查询出来(不符合条件的也需要)

li123 2004-11-01 06:15:09
我用如下语句:select
a.f_unit_name,
a.breportCount,
b.thisreportCount,
c.badoptCount,
d.thisadoptCount
from
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'',0,1)) breportCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2004-11-1'
group by
t.f_unit_name ) a ,
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'',0,1)) thisreportCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2004-11-1'
group by
t.f_unit_name ) b ,
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'1',0,1)) badoptCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2003-11-1'
group by
t.f_unit_name ) c ,
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'1',0,1)) thisadoptCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2004-11-1'
group by
t.f_unit_name ) d
where
a.f_unit_name = b.f_unit_name(+)
and
a.f_unit_name = c.f_unit_name(+)
and
a.f_unit_name = d.f_unit_name(+)

总的有四个部门,我要所有部门的数据,为空也要。
但是我用这个语句提不到所有数据,如果在一个表里没有数据就查不到了。
请问应如何做?
谢谢!!!
...全文
102 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
liuyi8903 2004-11-02
  • 打赏
  • 举报
回复
:)支持一下!
li123 2004-11-02
  • 打赏
  • 举报
回复
to zmgowin(隐者(龙祖宗)) :
非常谢谢,我想怕没有人会给我解答,代码太乱了,
再次感谢zmgowin。
zmgowin 2004-11-01
  • 打赏
  • 举报
回复
select
e.f_unit_name,
a.breportCount,
b.thisreportCount,
c.badoptCount,
d.thisadoptCount
from
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'',0,1)) breportCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2004-11-1'
group by
t.f_unit_name ) a ,
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'',0,1)) thisreportCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2004-11-1'
group by
t.f_unit_name ) b ,
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'1',0,1)) badoptCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2003-11-1'
group by
t.f_unit_name ) c ,
(select
t.f_unit_name,
sum(decode(t.f_is_adopt,'1',0,1)) thisadoptCount
from
t_ducha_file_info t
where
to_char(t.f_send_date,'yyyy-mm-dd') between '2002-6-1' and '2004-11-1'
group by
t.f_unit_name ) d,
t_ducha_file_info e,
where
e.f_unit_name = a.f_unit_name(+)
and
e.f_unit_name = b.f_unit_name(+)
and
e.f_unit_name = c.f_unit_name(+)
and
e.f_unit_name = d.f_unit_name(+)
版本:presto-server-0.214.tar软件版本 presto-cli-0.214-executableCentOS71、presto的起因 hadoop ---hdfs----MR(java)-----hivehive底层原理用MR,速度比较慢,公司hadoop集群主要集中于晚上到凌晨,平日工作时间负载不是很高。但在工作时间内,公司业务人员有实时查询的需求,现在主要借助于hive提供业务人员的查询。hive是基于MR类的SQL查询工具,他会输入的查询SQL解析为MapReduce,能极大的降低使用大数据门槛,让一般的业务人员可以直接准对大数据进行查询,但是有一个利弊,它的查询基于MR,会让人等待比较着急,等待的时间可能是几个小时或者一天。 spark基于内存提高改良的hive,sql,现在factbook在hive上面开发一套利器,准对hive可以通过sql语句快速查询,presto。2、Facebook为何开发Presto  Facebook的2011的数据仓库存储在少量大型hadoopfs集群,Hive是FaceBook在几年前专门为Hadoop打造的一款数据仓库工具,在以前,facebook的科学家和分析师一直靠hive进行数据分析.但hive使用MR作为底层计算框架,是专为批处理设计的,但是随着数据的不断增多,使用hive进行一个简单的数据查询可能要花费分钟或者几个小时,显然不能满足查询需求,FaceBooke也调研了其他比hive更快的工具,但是他们需要在功能有限的条件下做简单操作,以至于无法操作Facebook庞大的数据要求。2012年开始研究自己的框架--presto,每日可以超过1pb查询,而且速度比较快,faceBook声称Presto的性能比hive要好上10倍或者100倍,presto和hive都是facebook开发的 Presto是一个开源的分布式SQL查询引擎,适用于交互式查询数据量支持GB到PB字节。Presto的设计和编写完全是为了解决Facebook这样规模的商业数据仓库交互式分析和处理速度的问题Presto可以做什么 Presto支持在线数据查询,包括Hive kafka Cassandra关系数据库以及专门数据存储,一条Presto查询可以将多个数据源进行合并,可以跨越整个组织进行分析。Presto以分析师的需求作为目标,他们期望相应速度小于1秒到几分钟,Presto要么在使用速度的快的昂贵的商业方案,提高内存,要么是消耗大量的硬件进行快速查询。(128G 64G)本套课程教给如何在企业环境中使用Presto技术。

17,081

社区成员

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

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