24 Replies Latest reply: Feb 4, 2014 10:28 AM by Damian Slanovic RSS

    How to "left joining" using some criteria

    Damian Slanovic

      Hi everybody.

       

      Can't find an answer for this.

      I have an invoice table, with this fields:

      Number CreationDate Article Quantity

       

      And have a table with costs history of each article, with this fields:

      Article FromDate ToDate Cost

       

      I can't find a way to add a cost to each article in the invoice table, taking the valid cost at the moment of the creation of that invoice. This means that (CreationDate >= FromDate AND CreationDate <= ToDate), because each article can have many records in CostHistory table (no overlapping of date is allowed).

      How can I do that?

       

       

      Thanks in advance.

      Damian.