Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2011
    Posts
    24

    Question Unanswered: Minus # of months

    Hi, i have a person that has been approved for 8 months
    from 01/01/11 to 08/31/11

    what is the query to output 6 months

    and i would also like another column to show number of DAYS the person has been approved for

    Thanks

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Get someone that knows SQL to take a look at your tables, it shouldn't take too long.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Dec 2011
    Posts
    13
    Number of months:

    Code:
    SELECT DATEDIFF(mm, '2011-01-01', '2011-08-31');
    It returns 7 months, why do you need to get 6?

    Number of days:

    Code:
    SELECT DATEDIFF(dd, '2011-01-01', '2011-08-31');
    Returns 242 days

    Dmitry
    --

    http://www.sqlines.com - Free online SQL conversion
    Last edited by dm1; 12-09-11 at 18:49.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •