Convert JoinDate to Anniversary

  • Hi,

    Anyone know the formula to convert the Join_Date to Anniversary....

    I would like to have a column next to Join_Date in the select results as Anniversary, if it's less than 1 yr, it should list as in # of days.

    Please advise.

    SELECT DISTINCT

    n.ID,

    n.LAST_NAME,

    n.FIRST_NAME,

    n.FULL_ADDRESS,

    n.MEMBER_TYPE,

    n.BIRTH_DATE,

    n.JOIN_DATE,

    n.HOME_PHONE,

    n.EMAIL

    FROM Name n

    WHERE n.MEMBER_TYPE NOT IN('NM-CH','NM-F','NM-MP','NM-OT','NM-SP')

    Regards,
    SQLisAwe5oMe.

  • I was able to modify the script to do this but if someone is more than 1 yr but not yet 2 yrs, then I would like to display as 1 yr and months, etc.

    --Script to list all current members wit birthday & joindate

    SELECT DISTINCT

    n.ID,

    n.LAST_NAME,

    n.FIRST_NAME,

    n.FULL_ADDRESS,

    n.MEMBER_TYPE,

    n.BIRTH_DATE,

    n.JOIN_DATE,

    CONVERT (int,DATEDIFF(HOUR,n.JOIN_DATE,GETDATE())/8766)as ANNIVERSARY,

    n.HOME_PHONE,

    n.EMAIL

    FROM Name n

    WHERE n.MEMBER_TYPE NOT IN('NM-CH','NM-F','NM-MP','NM-OT','NM-SP')

    SQLisAwE5OmE (5/19/2016)


    Hi,

    Anyone know the formula to convert the Join_Date to Anniversary....

    I would like to have a column next to Join_Date in the select results as Anniversary, if it's less than 1 yr, it should list as in # of days.

    Please advise.

    SELECT DISTINCT

    n.ID,

    n.LAST_NAME,

    n.FIRST_NAME,

    n.FULL_ADDRESS,

    n.MEMBER_TYPE,

    n.BIRTH_DATE,

    n.JOIN_DATE,

    n.HOME_PHONE,

    n.EMAIL

    FROM Name n

    WHERE n.MEMBER_TYPE NOT IN('NM-CH','NM-F','NM-MP','NM-OT','NM-SP')

    Regards,
    SQLisAwe5oMe.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply