Results 1 to 6 of 6

Thread: To get previous month names

  1. #1
    Junior Member
    Join Date
    Mar 2008
    Answers
    9

    To get previous month names

    How can i get last there previous month names by useing system date


  2. #2
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Re: To get previous month names

    Select to_char(add_months(sysdate,-rownum),'month') prev_months from user_tables where rownum<=3;


  3. #3
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: To get previous month names

    Quote Originally Posted by krishnaindia2007 View Post
    Select to_char(add_months(sysdate,-rownum),'month') prev_months from user_tables where rownum<=3;
    Will that work in SQL server ?


  4. #4
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Re: To get previous month names

    Quote Originally Posted by debasisdas View Post
    Will that work in SQL server ?
    Sorry. I answered the question without observing forum.


  5. #5
    Junior Member
    Join Date
    Mar 2008
    Answers
    9

    Re: To get previous month names

    I got the answer for question


    select datename(month, dateadd("month",-1,getdate())), datename(month, dateadd("month",-2,getdate())),
    datename(month, dateadd("month",-3,getdate()))


  6. #6
    Contributing Member
    Join Date
    Apr 2008
    Answers
    31

    Re: To get previous month names

    Sorry boreddy u cant use month is quotes.

    Use
    select datename(month, dateadd(month,-1,getdate())), datename(month,
    dateadd(month,-2,getdate())),datename(month, dateadd(month,-3,getdate()))


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact