有两张表 table a,table b
table a 格式如下:product_id a_num
10001 145
10002 1156
10003 1515
10004 152
10005 158
.............table b 格式如下:
product_id b_num
10001 4664
10002 154
10003 452table b 的行数比table a少,
想建一个视图,由tablea.product_id,tablea.a_num,tableb.b_num组成。
create or replace view v_c as
select a.product_id,a.a_num,b.b_num
from tablea a,tableb b
where a.product_id = b.produt_id
可是建成以后发现视图的查询结果只有b表中的三行数据,不是我想要的a表中的五行数据。
我想达到的效果是,视图中数据的行数跟a表一致,b_num在b表中对应没有的,自动填充0
如何才能达到那样的效果呢?
table a 格式如下:product_id a_num
10001 145
10002 1156
10003 1515
10004 152
10005 158
.............table b 格式如下:
product_id b_num
10001 4664
10002 154
10003 452table b 的行数比table a少,
想建一个视图,由tablea.product_id,tablea.a_num,tableb.b_num组成。
create or replace view v_c as
select a.product_id,a.a_num,b.b_num
from tablea a,tableb b
where a.product_id = b.produt_id
可是建成以后发现视图的查询结果只有b表中的三行数据,不是我想要的a表中的五行数据。
我想达到的效果是,视图中数据的行数跟a表一致,b_num在b表中对应没有的,自动填充0
如何才能达到那样的效果呢?
解决方案 »
- win7装oracle 10g失败了,大虾们帮忙啊!!!3333333qqqqqqq
- ORACLE
- 求解,,,求解啊!!!!!!!!
- 请问在一个已经有10000多条记录的表里可不可以再增加或删除一个字段?修改一个字段的属性?要注意些什么?
- 哪里能下载到ORACLE9i的patch文件?(高分跪求!!!!!!)
- 这个问题的sql该怎样写?
- 有没有第三方的数据库同步软件(在线等)
- 怎么向数据类型为date的字段插入时间(hh:mm:ss)
- 问一个比较菜的问题:如何彻底的删除Oracle?
- 如何让Oracle表的索引暂时失效?然后恢复有效?
- 数据库.dmp文件无法导入
- 请问数据库是利用什么实现数据和应用分离的,谢谢!
select a.product_id,a.a_num,b.b_num
from tablea a,tableb b
where a.product_id(+) = b.produt_id;create or replace view v_c as
select a.product_id,a.a_num,b.b_num
from tablea a,tableb b
where a.product_id = b.produt_id(+);
select a.product_id,a.a_num,b.b_num
from tablea a,tableb b
where a.product_id = b.produt_id(+);