Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2017
    Posts
    1

    Unanswered: View for retrieving last 24 months data from the given input date

    Hi PostGre Users,

    I am new to this tool and need below help.

    I have a table where i need to fetch the data from last available 24 months from Table.

    For Ex:

    1.if the input date is 30-Oct -2017, the data should from 01-Nov-2015 to 30-Oct-2017

    Please help

  2. #2
    Join Date
    Nov 2003
    Posts
    2,993
    Provided Answers: 23
    Quote Originally Posted by ajay101 View Post
    Hi PostGre Users,
    There is no such thing as "PostGre". It's either Postgres or PostgreSQL
    You might want to read this: https://wiki.postgresql.org/wiki/FAQ...is_Postgres.3F

    Quote Originally Posted by ajay101 View Post
    I have a table where i need to fetch the data from last available 24 months from Table.

    For Ex:

    1.if the input date is 30-Oct -2017, the data should from 01-Nov-2015 to 30-Oct-2017
    Not sure what exactly you mean with that, but maybe something like this:
    Code:
    select *
    from the_table
    where the_date_column > current_date - interval '24 month';
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

Posting Permissions

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