类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
--- 所有客户的资金余额及托管市值(包含所有市场) --- begin
select a.fund_account,
b.client_name,
a.current_balance,
b.marketvalue,
b.money_type
from fund a
left join
(
-- 所有客户的托管市值(包含所有市场) --- begin
select a.fund_account,
ltrim(a.client_name) as client_name,
sum(a.marketvalue) as marketvalue,
a.money_type
from
(
-- 所有市场的持股明细(未汇总) CustomerMarketValueView --- begin
select a.fund_account,
c.client_name,
a.stock_code,
d.stock_name,
a.current_amount+a.real_buy_amount-a.real_sell_amount+a.correct_amount as amount,
marketvalue = (a.current_amount + a.correct_amount + a.real_buy_amount
- a.real_sell_amount + a.uncome_buy_amount - a.uncome_sell_amount) * isnull(b.asset_price,0),
case
when a.exchange_type in (1,2) then 0
when a.exchange_type = 2 then 1
when a.exchange_type = H then 2
end as money_type
-- e.dict_prompt as room_code
from stock a,
price b,
client c,
stkcode d
-- stringdictionary e
where a.fund_account = c.fund_account and a.exchange_type *= b.exchange_type
and a.stock_code *= b.stock_code and a.exchange_type *= d.exchange_type
and a.stock_code *= d.stock_code
-- and c.room_code = e.subentry
-- 所有市场的持股明细(未汇总) CustomerMarketValueView --- end
) a
group by a.fund_account, a.client_name, a.money_type
-- 所有客户的托管市值(包含所有市场) --- end
) b
on (a.fund_account = b.fund_account) and (a.money_type = b.money_type)
--- 所有客户的资金余额及托管市值(包含所有市场) --- end
执行上述代码,系统报错:在包含已联接的表的查询中,不能指定外联接操作符
网友回答: