7 Replies Latest reply: Nov 6, 2014 9:28 AM by Henric Cronström RSS

    Interval Match Question

      We have two tables. One table has columns 'ID' and 'Invoice Date'. Another one has columns 'ID', 'Start Date', 'End Date', and 'Price'. The desired output is 'ID', 'Invoice Date', 'Price'. I know this could be done using interval match but having a hard time figuring out how. Any help is highly appreciated. Attached is sample data for your convenience.

       

      Table 1:

      Product IDInvoiceDate
      A10/16/2014
      B08/01/2014

       

      Table 2:

      Product IDStart DateEnd DatePrice
      A06/01/201406/30/2014$200
      A07/01/201408/30/2014$350
      A09/01/201412/31/9999$400
      B06/01/201406/30/2014$250
      B07/01/201408/30/2014$240
      B09/01/201412/31/9999$300

       

      Desired Output:

       

      Product IDInvoiceDatePrice
      A06/02/2014$200
      A07/20/2014$350
      B06/20/2014$250
      B09/26/2014$300