查询多表数据,这样用临时表是否合理?是不是有更好的写法?这样写对性能会不会有很大的影响
    if object_id('tempdb..#t') is not null 
    drop table #t    if object_id('tempdb..#t2') is not null 
    drop table #t2    if object_id('tempdb..#t3') is not null 
    drop table #t3
--获得临时表#t
select a.*,b.JCode,b.FundName,b.CombId into #t from BM_FCombWinTbl a inner join BM_FCombDetailTbl b 
  on a.DetailId=b.DetailId 
  where b.CombId in(select CombId from BM_FundCombTbl 
  where CombType=101201 and UserId=@UserId) --获得临时表#t2
select #t.* into #t2 from #t,(select jcode,max(wdate) as wdate from #t group by jcode) b where #t.jcode=b.jcode and #t.wdate=b.wdate --获得临时表#t3
        select * into #t3 from BM_F_NetVTbl where ddate=dbo.aa_fun_getdate() and JCode in(select JCode from #t2) --获取结果
select #t3.NetVal,#t3.DayAddPer,#t3.dDate,#t2.* from #t2 inner join #t3 on #t2.JCode=#t3.JCode   drop table #t
   drop table #t2
   drop table #t3