#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    16
    Rep Power
    0

    fetching records with date range


    Hi,
    I have to fetch records from a table where the date difference is one year. My table structure looks like this:

    proposalid varchar(20),
    reviewerid varchar(20),
    proposal_title varchar(200),
    review_result varchar(30),
    review_time timestamp with time zone,
    review_desc text,

    I need to get records for a specific reviewerid where review_time is one year. In other words,
    I need to check how many proposals a reviewer has reviewed in one year duration.

    any hint or help will be appreciated
  2. #2
  3. Me likey breadsticks...
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2003
    Location
    Los Angeles
    Posts
    1,189
    Rep Power
    18

    Re: fetching records with date range


    Originally posted by veenasv
    Hi,
    I have to fetch records from a table where the date difference is one year. My table structure looks like this:

    proposalid varchar(20),
    reviewerid varchar(20),
    proposal_title varchar(200),
    review_result varchar(30),
    review_time timestamp with time zone,
    review_desc text,

    I need to get records for a specific reviewerid where review_time is one year. In other words,
    I need to check how many proposals a reviewer has reviewed in one year duration.

    any hint or help will be appreciated
    SELECT reviewerid, count(revierwerid) FROM tablename WHERE review_time >= NOW() - '1 year'::interval GROUP BY reviewerid .

    This is untested, but I believe it should give what you want - how many reviews a particular reviewer had over the last year.

    HTH,
    -b

    Comments on this post

    • niczak agrees : Excellent advice.
    PostgreSQL, it's what's for dinner...
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    16
    Rep Power
    0
    Thank you very much. This is what I wanted. I appreciate your help.

IMN logo majestic logo threadwatch logo seochat tools logo