oracle 左連接 . 如果一邊的沒有記錄, nvl (右邊,0) 否則會造成整列無法,無數據.
左連接 .如果一邊的沒有記錄, nvl (右邊,0) 否則會造成整列無法,無數據.
1
2
select d.crunit_ - nvl( a.stkamt_ ,0)
3
from dl_fundetf d ,
4
(select c.stkcode_, c.exchgcode_,c.stkamt_ ,c.stkcost_
5
from acc_proflstk c
6
where 1=1
7
and c.fundid_ = '55'
8
and c.cellid_ = '50001'
9
and c.proflid_ = '080724113732'
10
) a
11
where 1=1
12
and d.exchgcode_ = 'SH'
13
and d.fundid_ = '510051'
14
and a.exchgcode_ (+)= d.exchgcode_
15
and a.stkcode_ (+)= d.fundid_

2

3

4

5

6

7

8

9

10

11

12

13

14

15

posted on 2009-02-10 15:07 小高 閱讀(807) 評論(0) 編輯 收藏 所屬分類: Oracle