5 Replies Latest reply: May 17, 2011 7:10 PM by John Witherspoon RSS

    Best way to add 2 tables together?

    Chris Hopkins

      Hi all,

       

      Can someone guide me on the best or fastest way to add 2 tables together please?

       

      Currently i am building an application locally on my laptop, i want to try and get it right before i hand it over to the administrator to put it on the server.

      There are over 40 million records currently on our server which will need to be reloaded into this app, and obviously the data is increasing daily, so i am looking for the best way to add 2 tables together.

       

      The tables have 20+ fields and roughly half of the fields have the same field names.

       

      Here are my 2 tables...

       

       

      SET cFileName = $(vcRetailQVD)StoreStockMovement.qvd;
      IF QvdCreateTime('$(cFileName)') >= 0 THEN 
       StoreStockMovement:
        LOAD DISTINCT 
           StoreNumber, 
           ProductCode, 
           EANCode, 
           IssueNumber, 
           CurrentRSP, 
           CostPrice, 
           StockLevel, 
           ProductStatus, 
           ExtractedDate, 
           RentalCopies, 
           NumberOfRentals, 
           NumberOfRefunds, 
           ExRentalPrice, 
           ExRentalQuantity, 
           NoExRentalSold, 
           RentalRevenues, 
           OverdueCharges, 
           PriceBand, 
           MediaFormat, 
           RentalItem, 
           OnOrderQuantity, 
           MinimumStockLevel, 
           ReorderQuantity, 
           StockOnOrder, 
           ReservedStock, 
           StockInTransit, 
           SafetyDays, 
           OrderWeightWeek1, 
           OrderWeightWeek2, 
           OrderWeightWeek3, 
           OrderWeightWeek4, 
           OrderWeightWeek5, 
           OrderWeightWeek6, 
           OrderWeightWeek7, 
           OrderWeightWeek8, 
           OrderWeightWeek9, 
           OrderWeightWeek10, 
           OrderWeightWeek11, 
           OrderWeightWeek12, 
           OrderWeightWeek13, 
           MinimumOrderQuantity, 
           SoldOnWebsite, 
           DiscountCategoryName, 
           RSPAdjustment, 
           AdjustmentReason
           FROM $(cFileName) (qvd); 
      ENDIF
      SET cFileName = $(vcRetailQVD)StoreProductStock.qvd;
      IF QvdCreateTime('$(cFileName)') >= 0 THEN 
       StoreProductStock:
       LOAD DISTINCT
        StoreNumber, 
           StoreDate, 
           [Stock Movement Reason Code], 
           ProductCode, 
           EANCode, 
           IssueNumber, 
           CommodityGroup, 
           EmployeeId, 
           Narrative, 
           StockQty, 
           StockValue, 
           LinesAffected, 
           CostValueDiff, 
           RSPValueDiff, 
           ExtractedDate, 
           StoreTime 
           FROM $(cFileName) (qvd); 
      ENDIF
      
      

       

      Thanks