我只几把它合并后报错:select bb=isnull(d.ss,0)+isnull(f.ss,0)-isnull((select sum(move2_money) from move2 where f.rate_number = Move2_number and move2_type=1),0),aa= isnull(d.ss,0)+isnull(f.ss,0),f.rate_number,f.rate_t from (select ss=isnull(sum(invest_money),0),invest_number from invest where invest_second='2004' and invest_issue=4 and invest_banlance=0 group by invest_number ) d right join (select * from (select ss=isnull(sum(cc),0),invest_number from (select invest_number,invest_frist ,invest_second, cc=dd* b.agent_ma_zc from (select dd=sum(invest_money),invest_issue,invest_second ,invest_frist,invest_number,invest_banlance from invest group by invest_number,invest_frist,invest_second,invest_issue ,invest_banlance ) v right join (select distinct agent_name,agent_ma_zc,invest_issue from( select Invest_issue=max(Invest_issue),Invest_frist,Invest_second from Invest where Invest_second<>'2004' and Invest_banlance=0 and invest_issue=4 group by Invest_second,Invest_frist,Invest_issue ) a inner join Agent b on (a.Invest_frist=b.agent_name or a.invest_second=b.agent_name) and b.agent_rank='1') b on v.invest_issue=b.invest_issue and (v.invest_frist=b.agent_name or v.invest_second=b.agent_name) and v.invest_banlance=0)//下面的那个group 报错 group by invest_number) dd right join rate_1 rr on rr.rate_number=dd.invest_number怎么回事呢) f on d.invest_number=f.rate_number
group by invest_number) dd right join rate_1 rr on rr.rate_number=dd.invest_number 这里少个( 吧
) d right join (select * from (select ss=isnull(sum(cc),0),invest_number from (select invest_number,invest_frist ,invest_second, cc=dd* b.agent_ma_zc from (select dd=sum(invest_money),invest_issue,invest_second ,invest_frist,invest_number,invest_banlance from invest group by invest_number,invest_frist,invest_second,invest_issue ,invest_banlance ) v right join (select distinct agent_name,agent_ma_zc,invest_issue from( select Invest_issue=max(Invest_issue),Invest_frist,Invest_second from Invest where Invest_second<>'2004' and Invest_banlance=0 and invest_issue=4 group by Invest_second,Invest_frist,Invest_issue ) a inner join Agent b on (a.Invest_frist=b.agent_name or a.invest_second=b.agent_name) and b.agent_rank='1') b on v.invest_issue=b.invest_issue and (v.invest_frist=b.agent_name or v.invest_second=b.agent_name) and v.invest_banlance=0)//下面的那个group 报错 group by invest_number) dd right join rate_1 rr on rr.rate_number=dd.invest_number怎么回事呢) f on d.invest_number=f.rate_number
这里少个( 吧