2 Replies Latest reply: Aug 9, 2012 1:08 AM by Faisal Zahid RSS

    Join two tables by comparing dates

      Hi guys,


      I have two unrelated tables which i would like to join. Basically the primary table contains 'Interest_Charged' to a client. It has the following fields: Client_ID, Interest_amt and date. The second table has similiar fields for 'Brokerage_Charged' to a client with the following fields: Client_ID, Brokerage_amt, date and trader_ID. Please note that the primary table doesnt have a trader_ID


      The two tables have no correlation with the other but i would like to assign a relevent trader_ID based on the dates. Basically I would like to join a trader_ID (from the Second table into the primary) by comparing the dates field of the two tables. So for a data set where Interest_charged.Client_ID = Brokerage_Charged.Client_ID I would like to find the relevant trader_ID where the date value of the two tables are the closest or minimum.



      Can any one help me?