full join 的问题???
如:以下语句执行时会出错:
服务器: 消息 207,级别 16,状态 3,行 1
列名 'dkfid' 无效。
服务器: 消息 207,级别 16,状态 1,行 1
列名 'dkfid' 无效。
----------------------------郁闷,在SQL SERVER7.0里可以的,为什么到了2000就报错
select
isnull (a.dkfid,b.dkfid) as dkfid,
isnull (a.代销库存金额,0) as '代销库存金额',
isnull (a.月结库存金额,0) as '月结库存金额',
isnull (b.现金库存金额,0) as '现金库存金额',
isnull (b.混合库存金额,0) as '混合库存金额'
from
(select
isnull (d.dkfid,e.dkfid) as dkfid,
isnull (d.kcje,0) as '代销库存金额',
isnull (e.kcje,0) as '月结库存金额'
from
(select b.dkfid,sum(b.kcsl*b.kuccbj) as kcje
from #b a,sp_kfmx b
where a.dspid=b.dspid and a.beizhu like '%代销%'
group by b.dkfid) d
full join
(select b.dkfid,sum(b.kcsl*b.kuccbj) as kcje
from #b a,sp_kfmx b
where a.dspid=b.dspid and a.beizhu like '%月结%'
group by b.dkfid) e
on d.dkfid=e.dkfid ) a
full join
(select
isnull (f.dkfid,g.dkfid) as dkfif,
isnull (f.kcje,0) as '现金库存金额',
isnull (g.kcje,0) as '混合库存金额'
from
(select b.dkfid,sum(b.kcsl*b.kuccbj) as kcje
from #b a,sp_kfmx b
where a.dspid=b.dspid and a.beizhu like '%现金%'
group by b.dkfid) f
full join
(select b.dkfid,sum(b.kcsl*b.kuccbj) as kcje
from #b a,sp_kfmx b
where a.dspid=b.dspid
group by b.dkfid) g
on f.dkfid=g.dkfid) b
on a.dkfid=b.dkfid