有3张表,A与B是主子表,通过partcode相连接,C表通过cgid与B表左连接,可是A表怎么办呢?
例如:
A表
aid partcode status1 001 702 002 103 003 50 B表bid partcode cgid price1 001 b001 2.22 002 b002 3.03 003 b003 1.0
C表cid cgid qty 1 b001 202 b002 10
3 b003 304 b004 40 想实现的结果为cgid price*qtyb001 44(因为status='70')b002 0 (因为status != '70')b003 0 (因为status != '70')b004 0 (因为status != '70')
例如:
A表
aid partcode status1 001 702 002 103 003 50 B表bid partcode cgid price1 001 b001 2.22 002 b002 3.03 003 b003 1.0
C表cid cgid qty 1 b001 202 b002 10
3 b003 304 b004 40 想实现的结果为cgid price*qtyb001 44(因为status='70')b002 0 (因为status != '70')b003 0 (因为status != '70')b004 0 (因为status != '70')
解决方案 »
- 请高手说说dedicated server和MTS server各自的特点和区别
- 求一句子翻译
- delete 与 delete from 有区别吗
- 查询Oracle数据库遇到的问题, 求解答
- money在Oracle中应该定义为什么数据类型?
- 求教:在sqlserver中执行正确的但在oracle 出错!!
- 急!:Oracle的TNSListener服务坏了,怎么办啊?!!
- ***********Oracle dblink的问题?特急,在线等待!!!***********
- win7 32位下 oracle 11g.执行shutdown immediate时直接关闭了,再连接该数据库时就卡住了,重启也是卡
- 求助,为什么我连最基本的查询都是并行模式的
- 请教个case when的问题
- 如何写时间的详细存储过程
union all
select b.cgid , 0 from a , b, c where a.partcode = b.partcode and b.cgid = c.cgid and a.status <> '70'
union all
select b.cgid , 0 from a , b, c where a.partcode = b.partcode and b.cgid = c.cgid and a.status <> '70'
所以是错误的
from a join b
on a.partcode=b.partcode and a.status=70
right join c on b.cgid=c.cgid