代码之家  ›  专栏  ›  技术社区  ›  Serdia

如何提高查询性能,将数据插入到组合数据的多个表中

  •  0
  • Serdia  · 技术社区  · 7 年前

    where exists(select * from @ID d where d.ID = @TableData.ID) 
    

        --------------------------------------------
        declare @DateFrom datetime
                @DateTo datetime 
            --table that contain IDs only
                  declare @ID table (ID int) 
                  insert into @ID 
                    select ID 
                    from Table
                    where dates between @DateFrom and @DateTo 
    
            --table with data
            declare @TableData
                  select 
                    case...
                    case...
                    case...
                    case...
                from Table1
                        join Table1
                        join Table1
                        join Table1
                where exists(select * from @ID d where d.ID = @TableData.ID) --filtering only match IDs from @ID table
    
    ------------------------------------------------------------------
    

    我试图创造出“诱人”的产品,但仍然没有改进。

    1 回复  |  直到 7 年前
        1
  •  1
  •   Thailo    7 年前