2 Replies Latest reply: Aug 14, 2012 9:46 AM by Anita Fuchten RSS

    SQL -- help ... is there another way?

    Anita Fuchten

      I have some tables loaded in my script, and I want to 'pre-calc' some data between two tables ... somehow I think the way I implemented this is not really efficient . . . is there another way to do such thing?

       

      CALLS_temp:
      LOAD Calls.Callnr
               ,Calls.Serviceordernr
      RESIDENT Calls;
      
      LEFT JOIN (CALLS_temp)
      LOAD Serviceorders.Serviceordernr as Calls.Serviceordernr
               ,Serviceorders.Serviceordernr
      RESIDENT Serviceorders;
      
      LEFT JOIN (Calls)
      LOAD Calls.Callnr
             ,if(isnull([Calls.Serviceordernr]),'No SO', if(isnull(Serviceorders.Serviceordernr),'yes','no')) as [Calls.SOisRemoved]
      RESIDENT CALLS_temp;
      
      DROP TABLE CALLS_temp;
      

       

      some more explanation on the example above:

       

      I have Calls and I have Serviceorders . . . Calls contain a serviceordernr ... but some serviceordernr's are nog available in de ServiceOrder table (removed).

       

      Someone has suggestions how to do this more efficient??

       

      thx for you help!

       

      Anita