物料现有量表(简称moh) MTL_ONHAND_LOCATOR_V
物料表 (简称mis)mtl_system_items_b
mol:
物料 现有量 子库存
a 10 G1
b
1
W1
b
2
W2
d
1
W1
d
3
G1
e
1
G1
e
4
W1
e
10
W2
mis
物料 供应子库
a
W1
b
W1
c
W1
d
W1
e
W1
现在我想得到如下格式的结果,需要所有物料在特定W开头的子库存的现有量:
物料现有量子库存
a
0
NULL
b
1
W1
b
2
W2
c 0
NULL
d
1
W1
e
4
W1
e
10
W2
用过外部链接,只能实现 c 这种情况, a 这种情况怎么实现啊?
能用什么别的表吗?谢谢大侠啊
[ 本帖最后由 yashq1 于 2009-6-19 11:19 编辑 ]
select t2.wuliao,nvl(t1.shul,0) shul,
t1.kucun from tmp_mis t2
left join (select * from tmp_mol where kucun like '%W%' ) t1 on t1.wuliao = t2.wuliao
order by t2.wuliao,shul