Add a column value to date(which is an expression)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • didajosh
    New Member
    • Aug 2008
    • 47

    #1

    Add a column value to date(which is an expression)

    Hi,
    In the process of adding date:
    DateAdd("m",[LockupTermMonth s1],[ComittedDate])

    LockupTermMonth s1 - is a value that is coming from a table for the corresponding row.

    ComittedDate - This is an expression that is being calculated (using If Then condition) when the query runs.

    How will this be done?

    Please help...... :(

    Dipali
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    Dipali,

    There's no actual questioon here. What do you want to know?

    Comment

    • didajosh
      New Member
      • Aug 2008
      • 47

      #3
      Oops...I will try again,

      In the process of adding date:
      DateAdd("m",[LockupTermMonth s1],[ComittedDate])


      Here LockupTermMonth s1 and ComittedDate , are not fixed values, the table is like
      Table1 is:
      Fund::::::::::: :LockupTermMont hs1
      AO::::::::::::: :::::::: 36
      AP::::::::::::: :::::::: 36
      EW::::::::::::: ::::::::12


      Table2 is:
      Fund::::::::::: :::::ComittedDa te
      AO::::::::::::: ::::::::1/1/2001
      AO::::::::::::: ::::::::1/1/2002
      AO::::::::::::: ::::::::1/1/2003
      AO::::::::::::: ::::::::1/1/2006
      AO::::::::::::: ::::::::7/1/2006
      AP::::::::::::: ::::::::1/1/2001
      AP::::::::::::: ::::::::1/1/2002
      AP::::::::::::: ::::::::7/1/2005
      AP::::::::::::: ::::::::10/1/2007
      EW::::::::::::: ::::::::12/31/2002
      EW::::::::::::: ::::::::1/31/2003
      EW::::::::::::: ::::::::2/29/2004
      EW::::::::::::: ::::::::4/30/2004

      Now I want a resulting table as :

      Fund::::::::Com ittedDate:::::: : LockupTermMonth s1(IN TERMS OFDATE)

      How will this be done?

      Please help...... :(

      Regards,
      Dipali

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        Aah, now it starts to become clearer.

        I'll assume that you need the data displayed in a query for now (as you haven't provided any details of any new table to put the data into).

        Firstly we need to create a basic query that links the two tables on the key - [Fund]
        Code:
        SELECT T2.Fund,
               T2.CommittedDate,
               ...
        FROM Table2 AS T2 INNER JOIN Table1 AS T1
          ON T2.Fund=T1.Fund
        With that done, we need to look at what's required to display the date value you require (replacing the unspecified line #3).
        Code:
        DateAdd('m',T1.LockupTermMonths1,T2.CommittedDate) AS ReleaseDate
        NB. I've changed the spelling of your field ComittedDate as you will see. I strongly recommend you do this in your live database too (including all references to it). Anyone working on this will automatically understand what it means, but are likely to spell it the correct way without thinking.

        Comment

        Working...